How can the FFT analyze a wave in which the components are changing?
To create a spectrogram, a signal (e.g audio) is split into segments and then the FFT of each of those segments is computed and then the individual amplitude spectrums of those segments are put side by side.That is why with a spectogram you have both time and frequency components.You might want to see the diagram in THIS post so you can visualise how a spectrogram is produced.