Scientists had known since the mid-1800s that lines in light spectra from gases represent the chemical signatures of the elements such as hydrogen, helium and carbon. This knowledge was the result of testing spectra on Earth, but astronomers assumed that chemical signatures in the Sun's spectra would be same as those of gases analyzed on Earth.
A brilliant young British researcher, Cecilia Payne, changed that view. In 1925 she was working in the Harvard lab of William Shapley, one of the world's leading astrophysists. Shapley had met Payne at Cambridge University in England where she was doing her doctoral work on spectra. He was greatly impressed by her work and provided the opportunity for her to analyze Harvard's spectra archive, at the time the largest in the world.
During the course of her work at Harvard, Payne realized that the intense heat and pressure in stars determined the ionization states of the elements in a star. By analyzing the Sun's spectra using these new insights about ionization, Payne discovered that the Sun was comprised of predominantly hydrogen with small portions of about 18 other elements. She expected that other stars had the same composition, because of conditions of heat and pressure were probably similar to those of the Sun.
Payne's findings that the Sun's spectral lines represented ionized elements challenged the received view in astrophysics, and her doctoral assertion was at first rejected. However, the irrefutable evidence for her assertion was gradually accepted and her discovery made spectral analysis easier and more accurate. Payne's achievement was one of the great leaps in modern astronomical science. After a considerable struggle she became the first female Harvard professor well before women were able to get academic positions.