A spectral line is a dark or bright line in an otherwise uniform and continuous spectrum, resulting from emission or absorption of light in a narrow frequency range, compared with the nearby frequencies. Spectral lines are often used to identify atoms and molecules from their characteristic spectral lines. These "fingerprints" can be compared to the previously collected "fingerprints" of atoms and molecules, and are thus used to identify the atomic and molecular components of stars and planets which would otherwise be impossible.
Spectral lines are the result of interaction between a quantum system (usually atoms, but sometimes molecules or atomic nuclei) and a single photon. When a photon has about the right amount of energy to allow a change in the energy state of the system (in the case of an atom this is usually an electron changing orbitals), the photon is absorbed. Then it will be spontaneously re-emitted, either in the same frequency as the original or in a cascade, where the sum of the energies of the photons emitted will be equal to the energy of the one absorbed (assuming the system returns to its original state).
A spectral line may be observed either as an emission line or an absorption line. Which type of line is observed depends on the type of material and its temperature relative to another emission source. An absorption line is produced when photons from a hot, broad spectrum source pass through a cold material. The intensity of light, over a narrow frequency range, is reduced due to absorption by the material and re-emission in random directions. By contrast, a bright, emission line is produced when photons from a hot material are detected in the presence of a broad spectrum from a cold source. The intensity of light, over a narrow frequency range, is increased due to emission by the material.
Spectral lines are highly atom-specific, and can be used to identify the chemical composition of any medium capable of letting light pass through it (typically gas is used). Several elements were discovered by spectroscopic means, such as helium, thallium, and cerium. Spectral lines also depend on the physical conditions of the gas, so they are widely used to determine the chemical composition of stars and other celestial bodies that cannot be analyzed by other means, as well as their physical conditions.