GeV electron accelerators are essential to synchrotron radiation facilities and free electron lasers, and as modules for high-energy particle physics. Radio frequency based accelerators are limited to relatively low accelerating fields (10-50 MV/m) and hence require 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 the frontiers of high-energy physics. Laser wakefield accelerators (LWFA) in which particles are accelerated by the field of a plasma wave driven by an intense laser pulse produce electric fields several orders of magnitude stronger (10-100 GV/m) and so offer the potential of very compact devices. However, until now it has not been possible to maintain the required laser intensity, and hence acceleration, over the several centimetres needed to reach GeV energies. For this reason laser-driven accelerators have to date been limited to the 100 MeV scale. Contrary to predictions that PW-class lasers would be needed to reach GeV energies, here we demonstrate production of a high-quality electron beam with 1 GeV energy by channelling a 40 TW peak power laser pulse in a 3.3 cm long gas-filled capillary discharge waveguide. We anticipate that laser-plasma accelerators based on capillary discharge waveguides will have a major impact on the development of future femtosecond radiation sources such as x-ray free electron lasers and become a standard building block for next generation high-energy accelerators.