How exactly are spectral lines shifted?
You can think of a light wave as a clock with a particular frequency: peaks are passing you at regular intervals. If the clock runs more slowly (if, for instance, the emitter of light goes into a region of strong gravity), then the peaks of the wave are emitted more slowly, and pass you more slowly. This is the same as saying that the frequency decreases. Because the speed of light is fixed at , this means that the wavelength increases (). So a spectral line (of a particular frequency) gets redshifted.