Definition on Wikipedia:
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. 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.
With other words a spectral line is like a fingerprint. It can be used to identify the atoms, elements or molecules present in a star, galaxy or cloud of interstellar gas. If we separate the incoming light from a celestial source using a prism, we will often see a spectrum of colours crossed with discrete lines. Note that spectral lines can also occur in other regions of the electromagnetic spectrum. Although we can no longer use a prism to help identify them.
There are two types of spectral lines in the visible part of the electromagnetic spectrum:
Emission lines appear as discrete coloured lines, often on a black background, and correspond to specific wavelengths of light emitted by an object. Absorption lines – these appear as dark bands, often superimposed on a coloured continuum. And are the result of specific wavelengths being absorbed along the line-of-sight. Emission lines are seen as coloured lines on a black background.
Absorption lines are seen as black lines on a coloured background.