We present a skeletonized inversion method that inverts surface-wave data for the Qs quality factor. Similar to the inversion of dispersion curves for the S-wave velocity model, the complicated surface-wave arrivals are skeletonized as simpler data, namely the amplitude spectra of the windowed Rayleigh-wave arrivals. The optimal Qs model is the one that minimizes the difference in the peak frequencies of the predicted and observed Rayleigh wave arrivals using a gradient-based wave-equation optimization method. Solutions to the viscoelastic wave-equation are used to compute the predicted Rayleigh-wave arrivals and the misfit gradient at every iteration. This procedure, denoted as wave-equation Qs inversion (WQs), does not require the assumption of a layered model and tends to have fast and robust convergence compared to full waveform inversion (FWI). Numerical examples with synthetic and field data demonstrate that the WQs method can accurately invert for a smoothed approximation to the subsurface Qs distribution as long as the Vs model is known with sufficient accuracy.