This paper presents a new traveltime inversion method based on the wave equation. In this new method, designated as wave-equation traveltime inversion (WT), seismograms are computed by any full-wave forward modeling method (we use a finite-difference method). The velocity model is perturbed until the traveltimes from the synthetic seismograms are best fitted to the observed traveltimes in a least squares sense. A gradient optimization method is used and the formula for the Frechet derivative (perturbation of traveltimes with respect to velocity) is derived directly from the wave equation. No traveltime picking or ray tracing is necessary, and there are no high frequency assumptions about the data. Body wave, diffraction, reflection and head wave traveltimes can be incorporated into the inversion. In the high-frequency limit, WT inversion reduces to ray-based traveltime tomography. It can also be shown that WT inversion is approximately equivalent to full-wave inversion when the starting velocity model is 'close' to the actual model.Numerical simulations show that WT inversion succeeds for models with up to 80 percent velocity contrasts compared to the failure of full-wave inversion for some models with no more than 10 percent velocity contrast. We also show that the WT method succeeds in inverting a layered velocity model where a shooting ray-tracing method fails to compute the correct first arrival times. The disadvantage of the WT method is that it appears to provide less model resolution compared to full-wave inversion, but this problem can be remedied by a hybrid traveltime + full-wave inversion method (Luo and Schuster, 1989).