Laser-plasma accelerators of only a centimetre’s length have produced nearly monoenergetic electron bunches with energy as high as 1 GeV. Scaling these compact accelerators to multi-gigaelectronvolt energy would open the prospect of building X-ray free-electron lasers and linear colliders hundreds of times smaller than conventional facilities, but the 1 GeV barrier has so far proven insurmountable. Here, by applying new petawatt laser technology, we produce electron bunches with a spectrum prominently peaked at 2 GeV with only a few per cent energy spread and unprecedented sub-milliradian divergence. Petawatt pulses inject ambient plasma electrons into the laser-driven accelerator at much lower density than was previously possible, thereby overcoming the principal physical barriers to multi-gigaelectronvolt acceleration: dephasing between laser-driven wake and accelerating electrons and laser pulse erosion. Simulations indicate that with improvements in the laser-pulse focus quality, acceleration to nearly 10 GeV should be possible with the available pulse energy.