High-energy particle accelerators have been crucial in providing a deeper understanding of fundamental particles and the forces that govern their interactions. To increase the energy of the particles or to reduce the size of the accelerator, new acceleration schemes need to be developed. Plasma wakefield acceleration1–5, in which the electrons in a plasma are excited, leading to strong electric fields (so called ‘wakefields’), is one such promising acceleration technique. Experiments have shown that an intense laser pulse6–9 or electron bunch10,11 traversing a plasma can drive electric fields of tens of gigavolts per metre and above—well beyond those achieved in conventional radio-frequency accelerators (about 0.1 gigavolt per metre). However, the low stored energy of laser pulses and electron bunches means that multiple acceleration stages are needed to reach very high particle energies5,12. The use of proton bunches is compelling because they have the potential to drive wakefields and to accelerate electrons to high energy in a single acceleration stage13. Long, thin proton bunches can be used because they undergo a process called self-modulation14–16, a particle–plasma interaction that splits the bunch longitudinally into a series of high-density microbunches, which then act resonantly to create large wakefields. The Advanced Wakefield (AWAKE) experiment at CERN17–19 uses high-intensity proton bunches—in which each proton has an energy of 400 gigaelectronvolts, resulting in a total bunch energy of 19 kilojoules—to drive a wakefield in a ten-metre-long plasma. Electron bunches are then injected into this wakefield. Here we present measurements of electrons accelerated up to two gigaelectronvolts at the AWAKE experiment, in a demonstration of proton-driven plasma wakefield acceleration. Measurements were conducted under various plasma conditions and the acceleration was found to be consistent and reliable. The potential for this scheme to produce very high-energy electron bunches in a single accelerating stage20 means that our results are an important step towards the development of future high-energy particle accelerators21,22.