A closer look at Spectral fingerprint
Elements have different arrangements of electron energy levels.
Their associated wavelengths give astronomers a way to identify matter at a distance. Temperature and ionization influence which parts of a fingerprint are visible.
The same set of lines can stay recognizable when shifted together by motion. Relative spacing helps identify the pattern. A spectrograph spreads incoming light by wavelength and records the result.
Want to learn more about Spectral fingerprint? Spectroscopy on Wikipedia.

