Many physical properties of high-temperature superconductors are two-dimensional phenomena derived from their square-planar CuO2 building blocks. This is especially true of the magnetism from the copper ions. As mobile charge carriers enter the CuO2 layers, the antiferromagnetism of the parent insulators, where each copper spin is antiparallel to its nearest neighbours(1), evolves into a fluctuating state where the spins show tendencies towards magnetic order of a longer periodicity. For certain charge-carrier densities, quantum fluctuations are sufficiently suppressed to yield static long-period order(2-6), and external magnetic fields also induce such order(7-12). Here we show that, in contrast to the chemically controlled order in superconducting samples, the field-induced order in these same samples is actually three-dimensional, implying significant magnetic linkage between the CuO2 planes. The results are important because they show that there are three-dimensional magnetic couplings that survive into the superconducting state, and coexist with the crucial inter-layer couplings responsible for three-dimensional superconductivity. Both types of coupling will straighten the vortex lines, implying that we have finally established a direct link between technical superconductivity, which requires zero electrical resistance in an applied magnetic field and depends on vortex dynamics and the underlying antiferromagnetism of the cuprates.