Pairing of electrons in conventional superconductors occurs at the superconducting transition temperature Tc, creating an energy gap in the electronic density of states (DOS)1. In the high-Tc superconductors, a partial gap in the DOS exists for a range of temperatures above Tc (ref. 2). A key question is whether the gap in the DOS above Tc is associated with pairing, and what determines the temperature at which incoherent pairs form. Here we report the first spatially resolved measurements of gap formation in a high-Tc superconductor, measured on Bi2Sr2CaCu2O8+ samples with different Tc values (hole concentration of 0.12 to 0.22) using scanning tunnelling microscopy. Over a wide range of doping from 0.16 to 0.22 we find that pairing gaps nucleate in nanoscale regions above Tc. These regions proliferate as the temperature is lowered, resulting in a spatial distribution of gap sizes in the superconducting state3, 4, 5. Despite the inhomogeneity, we find that every pairing gap develops locally at a temperature Tp, following the relation 2/kBTp = 7.9 0.5. At very low doping (0.14), systematic changes in the DOS indicate the presence of another phenomenon6, 7, 8, 9, which is unrelated and perhaps competes with electron pairing. Our observation of nanometre-sized pairing regions provides the missing microscopic basis for understanding recent reports10, 11, 12, 13 of fluctuating superconducting response above Tc in hole-doped high-Tc copper oxide superconductors.