This is a very basic question, but I am a little confused. As far as I know, the temperature of a star is analyzed based on the color of the light it emits. So, if a star is moving away from us, then the light emitted by it will be redshifted(or if it is stationary with respect to us and the light undergoes gravitational redshift), then how do we know the exact temperature of that star or any other object because it is possible that we observe red light but actually the star might be emitting yellow light.
Spectral lines occur at defined wavelengths. By their redshift you can calculate the radial velocity (or gravitational redshift) of the star, or the absorbing medium, and hence the amount you've to shift the black body radiation to obtain the surface temperature (and the radial velocity of a possibly absorbing medium between the star and Earth).
Schematic example: Assume, you measure the following two stellar spectra, and you're able to identify the typical H-alpha spectral emission line. This line should be at 565.3 nm:
In the second spectrum, H-alpha is at the correct position: no redshift. In the first spectrum, it's redshifted (towards longer wavelength).
Although the measured intensity may be the same elsewhere in the spectrum, you'll know, that the first spectrum is of a hotter star, since the maximum intensity (besides the H-alpha line) is left (towards blue) of the H-alpha wavelength, whereas the maximum intensity in the second spetrum is right (towards red) of the H-alpha line.
Both stars would look reddish, but the first one is the hotter one, and it's redshifted, either due to Doppler shift, due to gravity, or due to cosmic expansion.