According to the generally accepted scenario, the last giant impact on Earth formed the Moon and initiated the final phase of core formation by melting Earth's mantle. A key goal of geochemistry is to date this event, but different ages have been proposed. Some argue for an early Moon-forming event, approximately 30 million years (Myr) after the condensation of the first solids in the Solar System, whereas others claim a date later than 50 Myr (and possibly as late as around 100 Myr) after condensation. Here we show that a Moon-forming event at 40 Myr after condensation, or earlier, is ruled out at a 99.9 per cent confidence level. We use a large number of N-body simulations to demonstrate a relationship between the time of the last giant impact on an Earth-like planet and the amount of mass subsequently added during the era known as Late Accretion. As the last giant impact is delayed, the late-accreted mass decreases in a predictable fashion. This relationship exists within both the classical scenario and the Grand Tack scenario of terrestrial planet formation, and holds across a wide range of disk conditions. The concentration of highly siderophile elements (HSEs) in Earth's mantle constrains the mass of chondritic material added to Earth during Late Accretion. Using HSE abundance measurements, we determine a Moon-formation age of 95 ± 32 Myr after condensation. The possibility exists that some late projectiles were differentiated and left an incomplete HSE record in Earth's mantle. Even in this case, various isotopic constraints strongly suggest that the late-accreted mass did not exceed 1 per cent of Earth's mass, and so the HSE clock still robustly limits the timing of the Moon-forming event to significantly later than 40 Myr after condensation.