Much of the current volume of Earth's continental crust had formed by the end of the Archaean eon1 (2.5 billion years ago), through melting of hydrated basaltic rocks at depths of approximately 25-50 kilometres, forming sodic granites of the tonalite-trondhjemite-granodiorite (TTG) suite2-6. However, the geodynamic setting and processes involved are debated, with fundamental questions arising, such as how and from where the required water was added to deep-crustal TTG source regions7,8. In addition, there have been no reports of voluminous, homogeneous, basaltic sequences in preserved Archaean crust that are enriched enough in incompatible trace elements to be viable TTG sources5,9. Here we use variations in the oxygen isotope composition of zircon, coupled with whole-rock geochemistry, to identify two distinct groups of TTG. Strongly sodic TTGs represent the most-primitive magmas and contain zircon with oxygen isotope compositions that reflect source rocks that had been hydrated by primordial mantle-derived water. These primitive TTGs do not require a source highly enriched in incompatible trace elements, as 'average' TTG does. By contrast, less sodic 'evolved' TTGs require a source that is enriched in both water derived from the hydrosphere and also incompatible trace elements, which are linked to the introduction of hydrated magmas (sanukitoids) formed by melting of metasomatized mantle lithosphere. By concentrating on data from the Palaeoarchaean crust of the Pilbara Craton, we can discount a subduction setting6,10-13, and instead propose that hydrated and enriched near-surface basaltic rocks were introduced into the mantle through density-driven convective overturn of the crust. These results remove many of the paradoxical impediments to understanding early continental crust formation. Our work suggests that sufficient primordial water was already present in Earth's early mafic crust to produce the primitive nuclei of the continents, with additional hydrated sources created through dynamic processes that are unique to the early Earth.