Conventional full-waveform inversion (FWI) using the least-squares norm as a misfit function is known to suffer from cycle-skipping issues that increase the risk of computing a local rather than the global minimum of the misfit. The quadratic Wasserstein metric has proven to have many ideal properties with regard to convexity and insensitivity to noise. When the observed and predicted seismic data are considered to be two density functions, the quadratic Wasserstein metric corresponds to the optimal cost of rearranging one density into the other, in which the transportation cost is quadratic in distance. Unlike the least-squares norm, the quadratic Wasserstein metric measures not only amplitude differences but also global phase shifts, which helps to avoid cycle-skipping issues. We have developed a new way of using the quadratic Wasserstein metric trace by trace in FWI and compare it with the global quadratic Wasserstein metric via the solution of the Monge-Ampère equation. We incorporate the quadratic Wasserstein metric technique into the framework of the adjoint-state method and apply it to several 2D examples. With the corresponding adjoint source, the velocity model can be updated using a quasi-Newton method. Numerical results indicate the effectiveness of the quadratic Wasserstein metric in alleviating cycle-skipping issues and sensitivity to noise. The mathematical theory and numerical examples demonstrate that the quadratic Wasserstein metric is a good candidate for a misfit function in seismic inversion.