Parallax means, in effect, distance. How may it be obtained spectroscopically? Consider a star so far away that its parallax is too small to observe. Observe its spectrum. Assume it is a main sequence star. That determines its luminosity. We see it, so we know its apparent magnitude. Now we have m, how bright it appears, and M, how bright it 'really is.' We may therefore figure out how far away it is. Voila! Spectroscopic parallax.
We will be wrong 10% of the time. We may have chosen a dwarf or giant; if so we would have started from the wrong M.