Cool X-ray Generation Fact: X-rays from Atoms
X-ray Generation from Atoms
Because the electron shells have different energies for different elements, each element has a unique spectral signature. Astronomers use tables of line energies to determine what lines are in the spectrum they are observing. These identifications then tell astronomers what elements are in the spectrum. Further, the strength of the line can tell astronomers how much of the element is in the object.
Astronomers can also note when the line is not at its expected energy. Then the line has been doppler shifted from its "rest energy" due to velocity of the object. This is important for determining the motion of objects in the universe. It's most important for determining that galaxies are moving away from us and that the universe is expanding.