Astronomers use the patterns of lines observed in stellar spectra to sort stars into a spectral class. Because a star’s temperature determines which absorption lines are present in its spectrum, these spectral classes are a measure of its surface temperature.