Earth, Venus, Mars and some extrasolar terrestrial planets1 have a mass and radius that is consistent with a mass fraction of about 30% metallic core and 70% silicate mantle. At the inner frontier of the Solar System, Mercury has a completely different composition, with a mass fraction of about 70% metallic core and 30% silicate mantle. Several formation or evolution scenarios are proposed to explain this metal-rich composition, such as a giant impact, mantle evaporation or the depletion of silicate at the inner edge of the protoplanetary disk. These scenarios are still strongly debated. Here, we report the discovery of a multiple transiting planetary system (K2-229) in which the inner planet has a radius of 1.165+/-0.066 Earth radii and a mass of 2.59+/-0.43 Earth masses. This Earth-sized planet thus has a core-mass fraction that is compatible with that of Mercury, although it was expected to be similar to that of Earth based on host-star chemistry. This larger Mercury analogue either formed with a very peculiar composition or has evolved, for example, by losing part of its mantle. Further characterization of Mercury-like exoplanets such as K2-229 b will help to put the detailed in situ observations of Mercury (with MESSENGER and BepiColombo) into the global context of the formation and evolution of solar and extrasolar terrestrial planets.