In the standard picture of a quantum phase transition, a single quantum critical point separates the phases at zero temperature. Here we show that the two-dimensional case is considerably more complex. Instead of the single point separating the antiferromagnet from the normal metal, we have discovered a broad region between these two phases where the magnetic order is destroyed but certain areas of the Fermi surface are closed by a large gap. This gap reflects the formation of a quantum state characterized by a superposition of d-wave superconductivity and a quadrupole density wave, which builds a chequerboard pattern with a period incommensurate with that of the original spin-density wave. At moderate temperatures both orders coexist over comparatively large distances but thermal fluctuations destroy the long-range order. Below a critical temperature the fluctuations are less essential and superconductivity becomes stable. This phenomenon may help to explain the origin of the mysterious pseudogap state and of the high-temperature transition into the superconducting state in the cuprates. In particular, we show that spectroscopic probes on the oxygen and copper sites reveal chequerboard order.