Laboratory experiments here on Earth have determined that each element in the periodic table emits photons only at certain wavelengths (determined by the excitation state of the atoms). These photons are manifest as either emission or absorption lines in the spectrum of an astronomical object, and by measuring the position of these spectral lines, we can determine which elements are present in the object itself or along the line of sight.
However, when astronomers perform this analysis, they note that for most astronomical objects, the observed spectral lines are all shifted to longer (redder) wavelengths. This is known as 'cosmological redshift' (or more commonly just 'redshift') and is given by:

for relatively nearby objects, where z is the cosmological redshift, λobs is the observed wavelength and λrest is the emitted/absorbed wavelength.
Caused solely by the expansion of the Universe, the value of the cosmological redshift indicates the recession velocity of the object, or its distance. For small velocities (less than half the speed of light), cosmological redshift is related to recession velocity ( v ) through:

where c the speed of light. At larger distances (higher redshifts), the theory of special relativity must be taken into account and the relation becomes:

The expression becomes even more complex at extremely high redshift.
For example, in a distant binary system it is theoretically possible to measure both a Doppler shift and a cosmological redshift. The Doppler shift would be determined by the motions of the individual stars in the binary - whether they were approaching or receding at the time the photons were emitted. The cosmological redshift would be determined by how far away the system was when the photons were emitted. The larger the distance to the system, the longer the emitted photons have travelled through expanding space and the higher the measured cosmological redshift.