The spectrum of the hydrogen atom has played a central part in fundamental physics over the past 200 years. Historical examples of its importance include the wavelength measurements of absorption lines in the solar spectrum by Fraunhofer, the identification of transition lines by Balmer, Lyman and others, the empirical description of allowed wavelengths by Rydberg, the quantum model of Bohr, the capability of quantum electrodynamics to precisely predict transition frequencies, and modern measurements of the 1S-2S transition by Hänsch 1 to a precision of a few parts in 10 15 . Recent technological advances have allowed us to focus on antihydrogen-the antimatter equivalent of hydrogen 2-4 . The Standard Model predicts that there should have been equal amounts of matter and antimatter in the primordial Universe after the Big Bang, but today's Universe is observed to consist almost entirely of ordinary matter. This motivates the study of antimatter, to see if there is a small asymmetry in the laws of physics that govern the two types of matter. In particular, the CPT (charge conjugation, parity reversal and time reversal) theorem, a cornerstone of the Standard Model, requires that hydrogen and antihydrogen have the same spectrum. Here we report the observation of the 1S-2S transition in magnetically trapped atoms of antihydrogen. We determine that the frequency of the transition, which is driven by two photons from a laser at 243 nanometres, is consistent with that expected for hydrogen in the same environment. This laser excitation of a quantum state of an atom of antimatter represents the most precise measurement performed on an anti-atom. Our result is consistent with CPT invariance at a relative precision of about 2 × 10 −10 .