Earth’s oldest evolved (felsic) rocks, the 4.02-billion-year-old Idiwhaa gneisses of the Acasta Gneiss Complex, northwest Canada, have compositions that are distinct from the felsic rocks that typify Earth’s ancient continental nuclei, implying that they formed through a different process. Using phase equilibria and trace element modelling, we show that the Idiwhaa gneisses were produced by partial melting of iron-rich hydrated basaltic rocks (amphibolites) at very low pressures, equating to the uppermost ~3 km of a Hadean crust that was dominantly mafic in composition. The heat required for partial melting at such shallow levels is most easily explained through meteorite impacts. Hydrodynamic impact modelling shows not only that this scenario is physically plausible, but also that the region of shallow partial melting appropriate to formation of the Idiwhaa gneisses would have been widespread. Given the predicted high flux of meteorites in the late Hadean, impact melting may have been the predominant mechanism that generated Hadean felsic rocks.