Raman spectroscopy measures temperature by analyzing the Raman shift, which is the change in the frequency of light scattered by molecules. The intensity of the Stokes and anti-Stokes lines in the Raman spectrum changes with temperature. By comparing these intensities, the temperature of the sample can be determined with high spatial resolution and without direct contact.