An analogue spectrum analyzer uses basically a variable bandpass filter which mid-frequency is automatically tuned (shifted, swept) through the range of frequencies of which the spectrum is to be measured.
A digital spectrum analyzer uses fast Fourier transform (FFT), a mathematical processes transforms a waveform into its compositions of frequencies in the spectrum. As a result, computer programs can compute such transforms, and makes audio processing easier. FFTs have applications in much wider fields.