stft focuses on the FT of windowed and segmented (overlaped) data and the output can be used to reconstruct the original (under certain condition).
spectrogram focuses on the spectral estimation based on STFT. It has the options for power spectrum or power spectrum density. It has the option of 'reassigned' to sharpen spectrogram.