Kelvin calculated the age of the Earth to be about 24 million years by assuming conductive cooling from being fully molten to its current state. Although simplistic, his result is interesting in the context of the dramatic cooling that took place after the putative Moon-forming giant impact, which contributed the final ∼10 per cent of the Earth's mass. The rate of accretion and core segregation on Earth as deduced from the U–Pb system is much slower than that obtained from Hf–W systematics and implies substantial accretion after the Moon-forming impact, which occurred 45 ± 5 Myr after the beginning of the Solar System. Here we propose an explanation for the two timescales. We suggest that the Hf–W timescale reflects the principal phase of core-formation before the giant impact. Crystallization of silicate perovskite in the lower mantle during this phase produced Fe³⁺, which was released during the giant impact, and this oxidation resulted in late segregation of sulphur-rich metal into which Pb dissolved readily, setting the younger U–Pb age of the Earth. Separation of the latter metal then occurred 30 ± 10 Myr after the Moon-forming impact. Over this time span, in surprising agreement with Kelvin's result, the Earth cooled by about 4,000 K in returning from a fully molten to a partially crystalline state.