Early stellar spectroscopy merely put a prism in the light path, after it was focused by the primary mirror, but before it reached the focal plane (where the photographic plates/film is).
This produces a star field, like you normally observe, but each star is smeared out into it's rainbow spectrum instead of being just a pin point of light. Each star had it's own spectrum, right where that star normally appears, so there's no chance of mixing up any spectra, unless you have very closely spaced stars where the spectra overlap...in which case you skip those until you can get a higher magnification that seperates them out.
Newer approaches use CCD cameras. One I'm familiar with actually involves making a physical plate, with holes cut out where the stars would appear on a normal photographic plate. Each hole is then fitted with a fiber optic cable that then feeds the light from that single star through to the instrument package for automatic computer analysis.