Improving the vertical resolution is one of the significant tasks for seismic data processing. Most traditional resolution-enhancement techniques assume that the seismic wavelet is time-invariant. However, the seismic wavelet varies with seismic wave propagation in the subsurface. To solve this issue, a new spectral-modeling method is proposed to extract the time-varying wavelet using improved generalized S-transform (IGST) and higher-order Fourier series. The IGST based on modified time-window function can effectively improve the resolution of the time-frequency (t-f) spectrum. The high-order Fourier series is used to fit on the logarithm t-f spectrum and achieve the high-precision time-varying wavelet. The proposed method is composed of four steps in the implementation. Firstly, the seismic data is decomposed by the IGST and converted to the logarithm t-f domain. Secondly, the time-varying wavelet spectrum is modeled at each time sample using a higher-order Fourier series. Thirdly, the boxcar smoothing method is used to smooth the time-varying wavelet spectrum and extract the time-varying wavelet with Hilbert transform. Finally, using the time-varying wavelet spectrum to spectrally balance seismic data to flatten the seismic response. Synthetic and field data examples demonstrate the feasibility of the proposed method in improving the signal-to-noise ratio and enhancing the vertical resolution.