For decades, the source of Earth's volatiles, especially water with a deuterium-to-hydrogen ratio (D/H) of (1.558+/-0.001)×10-4, has been a subject of debate. The similarity of Earth's bulk composition to that of meteorites known as enstatite chondrites suggests a dry proto-Earth with subsequent delivery of volatiles by local accretion or impacts of asteroids or comets. Previous measurements in six comets from the Oort cloud yielded a mean D/H ratio of (2.96+/-0.25)×10-4. The D/H value in carbonaceous chondrites, (1.4+/-0.1)×10-4, together with dynamical simulations, led to models in which asteroids were the main source of Earth's water, with <=10 per cent being delivered by comets. Here we report that the D/H ratio in the Jupiter-family comet 103P/Hartley 2, which originated in the Kuiper belt, is (1.61+/-0.24)×10-4. This result substantially expands the reservoir of Earth ocean-like water to include some comets, and is consistent with the emerging picture of a complex dynamical evolution of the early Solar System.