Stars generally only display absorption line spectra, but when a cloud of inter-stellar gas is excited by incoming radiation, electrons in that gas can be excited and go up in energy level through absorption. Subsequently, these electrons can come down again and thus emit photons of very specific energy. This generates bright lines in the spectrum for those specific wavelengths, an emission spectrum.
Absorption and emission lines for each chemical element are at the same location in the spectrum. The lines are either dark in an absorption spectrum and bright in an emission spectrum.
Hydrogen and other elements
The most abundant element in the Universe is Hydrogen that has only one electron in each atom. The different energy jumps of that electron however give four absorption lines in the visible part of the spectrum. Other absorption lines are in the IR and in the UV part of the spectrum.
Other chemical elements, that have more electrons form more complicated spectra, but each element produces its own specific line spectrum. For this reason astronomers can find out which elements are present in stars, even when these stars are at very great distance.
Some examples of the emission spectrum of other elements