One focus of modern astronomy is to detect temperate terrestrial exoplanets well-suited for atmospheric characterisation. A milestone was recently achieved with the detection of three Earth-sized planets transiting (i.e. passing in front of) a star just 8% the mass of the Sun 12 parsecs away. Indeed, the transiting configuration of these planets with the Jupiter-like size of their host star - named TRAPPIST-1 - makes possible in-depth studies of their atmospheric properties with current and future astronomical facilities. Here we report the results of an intensive photometric monitoring campaign of that star from the ground and with the Spitzer Space Telescope. Our observations reveal that at least seven planets with sizes and masses similar to the Earth revolve around TRAPPIST-1. The six inner planets form a near-resonant chain such that their orbital periods (1.51, 2.42, 4.04, 6.06, 9.21, 12.35 days) are near ratios of small integers. This architecture suggests that the planets formed farther from the star and migrated inward. The seven planets have equilibrium temperatures low enough to make possible liquid water on their surfaces.