The conduction of heat through minerals and melts at extreme pressures and temperatures is of central importance to the evolution and dynamics of planets. In the cooling Earth’s core, the thermal conductivity of iron alloys defines the adiabatic heat flux and therefore the thermal and compositional energy available to support the production of Earth’s magnetic field via dynamo action1, 2, 3. Attempts to describe thermal transport in Earth’s core have been problematic, with predictions of high thermal conductivity4, 5, 6, 7 at odds with traditional geophysical models and direct evidence for a primordial magnetic field in the rock record8, 9, 10. Measurements of core heat transport are needed to resolve this difference. Here we present direct measurements of the thermal conductivity of solid iron at pressure and temperature conditions relevant to the cores of Mercury-sized to Earth-sized planets, using a dynamically laser-heated diamond-anvil cell11, 12. Our measurements place the thermal conductivity of Earth’s core near the low end of previous estimates, at 18–44 watts per metre per kelvin. The result is in agreement with palaeomagnetic measurements10 indicating that Earth’s geodynamo has persisted since the beginning of Earth’s history, and allows for a solid inner core as old as the dynamo.