Most of the baryons in galaxy clusters reside between the galaxies in a hot, tenuous gas. The densest gas in their centres should cool and accrete onto giant central galaxies at rates of 10-1,000 solar masses per year. No viable repository for this gas, such as clouds or new stars, has been found. New X-ray observations, however, have revealed far less cooling below X-ray temperatures than expected, altering the previously accepted picture of cooling flows. As a result, most of the gas must be heated to and maintained at temperatures above ~2keV (ref. 3). The most promising heating mechanism is powerful radio jets emanating from supermassive black holes in the central galaxies of clusters. Here we report the discovery of giant cavities and shock fronts in a distant (z = 0.22) cluster caused by an interaction between a radio source and the hot gas surrounding it. The energy involved is ~6 × 1061 erg, the most powerful radio outburst known. This is enough energy to quench a cooling flow for several Gyr, and to provide ~1/3keV per particle of heat to the surrounding cluster.