Planets with sizes between that of Earth (with radius ) and Neptune (about 4) are now known to be common around Sun-like stars. Most such planets have been discovered through the transit technique, by which the planet's size can be determined from the fraction of starlight blocked by the planet as it passes in front of its star. Measuring the planet's mass--and hence its density, which is a clue to its composition--is more difficult. Planets of size 2-4 have proved to have a wide range of densities, implying a diversity of compositions, but these measurements did not extend to planets as small as Earth. Here we report Doppler spectroscopic measurements of the mass of the Earth-sized planet Kepler-78b, which orbits its host star every 8.5 hours (ref. 6). Given a radius of 1.20 +/- 0.09 and a mass of 1.69 +/- 0.41, the planet's mean density of 5.3 +/- 1.8 g cm-3 is similar to Earth's, suggesting a composition of rock and iron.