A wave-equation gradient optimization method is presented that inverts for the subsurface Q distribution by minimizing a skeletonized misfit function ε. Here, ε is the sum of the squared differences between the observed and the predicted peak/centroid frequency shifts of the early-arrivals. The gradient is computed by migrating the observed traces weighted by the frequency-shift residuals. The background Q model is perturbed until the predicted and the observed traces have the same peak frequencies or the same centroid frequencies. Numerical tests show that an improved accuracy of the inverted Q model by wave-equation Q tomography (WQ) leads to a noticeable improvement in the migration image quality.