The growing number of urban seismological experiments within the framework of seismic hazard studies has increased the necessity of effective tools for denoising seismograms. Because of the frequency dependency of seismic noise and the nonstationarity of the recorded signal, tools that can effectively take into account the frequency-time variation of the seismic recordings are more suitable for fulfilling this task. The S transform is an invertible time-frequency spectral localization technique that combines elements of wavelet transforms and short-time Fourier transforms. In this study, a customized thresholding technique is applied to the S-transform coefficients for obtaining an optimally (in the sense of the maximum increase of the signal-to-noise ratio with a minimal loss of information) denoised seismogram. Tests performed with synthetic data allow us to calibrate the optimal denoising procedure parameters and show the effectiveness of the proposed method when compared with standard filtering techniques. The application of a combination of denoising with time-frequency filtering on real data shows the potential of the method for extracting lower amplitude dispersive arrivals from seismograms.