Gigaelectron volt (GeV) electron accelerators are essential to synchrotron radiation facilities and free-electron lasers, and as modules for high-energy particle physics. Radiofrequency-based accelerators are limited to relatively low accelerating fields (10-50MVm-1), requiring tens to hundreds of metres to reach the multi-GeV beam energies needed to drive radiation sources, and many kilometres to generate particle energies of interest to high-energy physics. Laser-wakefield accelerators produce electric fields of the order 10-100GVm-1 enabling compact devices. Previously, the required laser intensity was not maintained over the distance needed to reach GeV energies, and hence acceleration was limited to the 100 MeV scale. Contrary to predictions that petawatt-class lasers would be needed to reach GeV energies, here we demonstrate production of a high-quality electron beam with 1GeV energy by channelling a 40TW peak-power laser pulse in a 3.3-cm-long gas-filled capillary discharge waveguide.