High-contrast near-infrared imaging of the nearby star HR 8799 has shown three giant planets. Such images were possible because of the wide orbits (>25astronomical units, where 1AU is the Earth-Sun distance) and youth (<100Myr) of the imaged planets, which are still hot and bright as they radiate away gravitational energy acquired during their formation. An important area of contention in the exoplanet community is whether outer planets (>10AU) more massive than Jupiter form by way of one-step gravitational instabilities or, rather, through a two-step process involving accretion of a core followed by accumulation of a massive outer envelope composed primarily of hydrogen and helium. Here we report the presence of a fourth planet, interior to and of about the same mass as the other three. The system, with this additional planet, represents a challenge for current planet formation models as none of them can explain the in situ formation of all four planets. With its four young giant planets and known cold/warm debris belts, the HR 8799 planetary system is a unique laboratory in which to study the formation and evolution of giant planets at wide (>10AU) separations.