After decades of speculation, the existence of binary asteroids has been observationally confirmed, with examples in all minor planet populations. However, no triple systems have hitherto been discovered. Here we report the unambiguous detection of a triple asteroidal system in the main belt, composed of a 280-km primary (87 Sylvia) and two small moonlets orbiting at 710 and 1,360km. We estimate their orbital elements and use them to refine the shape of the primary body. Both orbits are equatorial, circular and prograde, suggesting a common origin. Using the orbital information to estimate its mass and density, 87 Sylvia appears to have a rubble-pile structure with a porosity of 25-60 per cent. The system was most probably formed through the disruptive collision of a parent asteroid, with the new primary resulting from accretion of fragments, while the moonlets are formed from the debris, as has been predicted previously.