Say, for example, I am looking at a distant star. I record the different intensities of light of different wavelengths and observe some spectrum lines. Now, since there are three factors affecting what I see - the temperature of the star, the speed at which the star is receding away from me, and the components of the star - how could I, first of all, tell what components the spectrum lines are of (let's say there are many components of roughly equal abundance) and, consequently, how much each of the two remaining factors contributes to the observed intensities?
The temperature does not shift the spectral lines, it only makes them broader (it gives them a Gaussian profile). So you can measure the temperature directly from these.
And the Doppler effect scales all of the spectral lines by the same factor.
Now, you can measure the spectral lines of all of the elements in the lab. So all you need to do is scale your observed spectral lines, run the known spectral lines for each element along to see if you get any matches (if so, add to a tally), then scale the observed spectral lines again and repeat. Find the scaling factor that maximises the number of matches. That gives you the scaling factor (and therefore speed).
(This probably isn't how it's done in practice, but it's the same principle)