Remote observations of the asteroid (1) Ceres from ground- and space-based telescopes have provided its approximate density and shape, leading to a range of models for the interior of Ceres, from homogeneous to fully differentiated1,2,3,4,5,6. A previously missing parameter that can place a strong constraint on the interior of Ceres is its moment of inertia, which requires the measurement of its gravitational variation1,7 together with either precession rate8,9 or a validated assumption of hydrostatic equilibrium10. However, Earth-based remote observations cannot measure gravity variations and the magnitude of the precession rate is too small to be detected9. Here we report gravity and shape measurements of Ceres obtained from the Dawn spacecraft, showing that it is in hydrostatic equilibrium with its inferred normalized mean moment of inertia of 0.37. These data show that Ceres is a partially differentiated body, with a rocky core overlaid by a volatile-rich shell, as predicted in some studies1,4,6. Furthermore, we show that the gravity signal is strongly suppressed compared to that predicted by the topographic variation. This indicates that Ceres is isostatically compensated11, such that topographic highs are supported by displacement of a denser interior. In contrast to the asteroid (4) Vesta8,12, this strong compensation points to the presence of a lower-viscosity layer at depth, probably reflecting a thermal rather than compositional gradient1,4. To further investigate the interior structure, we assume a two-layer model for the interior of Ceres with a core density of 2,460-2,900 kilograms per cubic metre (that is, composed of CI and CM chondrites13), which yields an outer-shell thickness of 70-190 kilometres. The density of this outer shell is 1,680-1,950 kilograms per cubic metre, indicating a mixture of volatiles and denser materials such as silicates and salts14. Although the gravity and shape data confirm that the interior of Ceres evolved thermally1,4,6, its partially differentiated interior indicates an evolution more complex than has been envisioned for mid-sized (less than 1,000 kilometres across) ice-rich rocky bodies.