Physical laws are believed to be invariant under the combined transformations of charge, parity and time reversal (CPT symmetry1). This implies that an antimatter particle has exactly the same mass and absolute value of charge as its particle counterpart. Metastable antiprotonic helium ( He+) is a three-body atom2 consisting of a normal helium nucleus, an electron in its ground state and an antiproton ( ) occupying a Rydberg state with high principal and angular momentum quantum numbers, respectively n and l, such that n ≈ l + 1 ≈ 38. These atoms are amenable to precision laser spectroscopy, the results of which can in principle be used to determine the antiproton-to-electron mass ratio and to constrain the equality between the antiproton and proton charges and masses. Here we report two-photon spectroscopy of antiprotonic helium, in which 3He+ and 4He+ isotopes are irradiated by two counter-propagating laser beams. This excites nonlinear, two-photon transitions of the antiproton of the type (n, l) (n − 2, l − 2) at deep-ultraviolet wavelengths (λ = 139.8, 193.0 and 197.0 nm), which partly cancel the Doppler broadening of the laser resonance caused by the thermal motion of the atoms. The resulting narrow spectral lines allowed us to measure three transition frequencies with fractional precisions of 2.3–5 parts in 109. By comparing the results with three-body quantum electrodynamics calculations, we derived an antiproton-to-electron mass ratio of 1,836.1526736(23), where the parenthetical error represents one standard deviation. This agrees with the proton-to-electron value known to a similar precision.