One aim of modern astronomy is to detect temperate, Earth-like exoplanets that are well suited for atmospheric characterization. Recently, three Earth-sized planets were detected that transit (that is, pass in front of) a star with a mass just eight per cent that of the Sun, located 12 parsecs away. The transiting configuration of these planets, combined with the Jupiter-like size of their host star—named TRAPPIST-1—makes possible in-depth studies of their atmospheric properties with present-day and future astronomical facilities. Here we report the results of a photometric monitoring campaign of that star from the ground and space. Our observations reveal that at least seven planets with sizes and masses similar to those of 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.1 and 12.35 days) are near-ratios of small integers. This architecture suggests that the planets formed farther from the star and migrated inwards. Moreover, the seven planets have equilibrium temperatures low enough to make possible the presence of liquid water on their surfaces.