A universal set of logic gates in a superconducting quantum circuit is shown to have gate fidelities at the threshold for fault-tolerant quantum computing by the surface code approach, in which the quantum bits are distributed in an array of planar topology and have only nearest-neighbour couplings. Quantum computers can only work in practice if, like conventional computers, they are fault-tolerant. This means that a system has to be in place to detect any errors and correct them. For quantum error correction such a system involves entangling several quantum bits (qubits) with each other. In the so-called surface code error-correction architecture, qubits are placed in a lattice and are entangled with four nearest neighbours. Rami Barends et al. report the construction of such a surface code system with five qubits in a row made from superconducting devices. This system performs with fidelity that is at the threshold for quantum error correction, suggesting that error-free quantum computing should be possible. The platform lends itself to scaling up to larger numbers of qubits and two-dimensional architecture. A quantum computer can solve hard problems, such as prime factoring1,2, database searching3,4 and quantum simulation5, at the cost of needing to protect fragile quantum states from error. Quantum error correction6 provides this protection by distributing a logical state among many physical quantum bits (qubits) by means of quantum entanglement. Superconductivity is a useful phenomenon in this regard, because it allows the construction of large quantum circuits and is compatible with microfabrication. For superconducting qubits, the surface code approach to quantum computing7 is a natural choice for error correction, because it uses only nearest-neighbour coupling and rapidly cycled entangling gates. The gate fidelity requirements are modest: the per-step fidelity threshold is only about 99 per cent. Here we demonstrate a universal set of logic gates in a superconducting multi-qubit processor, achieving an average single-qubit gate fidelity of 99.92 per cent and a two-qubit gate fidelity of up to 99.4 per cent. This places Josephson quantum computing at the fault-tolerance threshold for surface code error correction. Our quantum processor is a first step towards the surface code, using five qubits arranged in a linear array with nearest-neighbour coupling. As a further demonstration, we construct a five-qubit Greenberger–Horne–Zeilinger state8,9 using the complete circuit and full set of gates. The results demonstrate that Josephson quantum computing is a high-fidelity technology, with a clear path to scaling up to large-scale, fault-tolerant quantum circuits.