At the historic Shelter Island Conference on the Foundations of Quantum Mechanics in 1947, Willis Lamb reported an unexpected feature in the fine structure of atomic hydrogen: a separation of the 2S(1/2) and 2P(1/2) states(1). The observation of this separation, now known as the Lamb shift, marked an important event in the evolution of modern physics, inspiring others to develop the theory of quantum electrodynamics(2-5). Quantum electrodynamics also describes antimatter, but it has only recently become possible to synthesize and trap atomic antimatter to probe its structure. Mirroring the historical development of quantum atomic physics in the twentieth century, modern measurements on anti-atoms represent a unique approach for testing quantum electrodynamics and the foundational symmetries of the standard model. Here we report measurements of the fine structure in the n = 2 states of antihydrogen, the antimatter counterpart of the hydrogen atom. Using optical excitation of the 1S-2P Lyman-alpha transitions in antihydrogen(6), we determine their frequencies in a magnetic field of 1 tesla to a precision of 16 parts per billion. Assuming the standard Zeeman and hyperfine interactions, we infer the zero-field fine-structure splitting (2P(1/2)-2P(3/2)) in antihydrogen. The resulting value is consistent with the predictions of quantum electrodynamics to a precision of 2 per cent. Using our previously measured value of the 1S-2S transition frequency(6,7), we find that the classic Lamb shift in antihydrogen (2S(1/2)-2P(1/2) splitting at zero field) is consistent with theory at a level of 11 per cent. Our observations represent an important step towards precision measurements of the fine structure and the Lamb shift in the antihydrogen spectrum as tests of the charge-parity-time symmetry(8) and towards the determination of other fundamental quantities, such as the antiproton charge radius(9,10), in this antimatter system. Precision measurements of the 1S-2P transition in antihydrogen that take into account the standard Zeeman and hyperfine effects confirm the predictions of quantum electrodynamics.