The brightness of an active galactic nucleus is set by the gas falling onto it from the galaxy, and the gas infall rate is regulated by the brightness of the active galactic nucleus; this feedback loop is the process by which supermassive black holes in the centres of galaxies may moderate the growth of their hosts. Gas outflows (in the form of disk winds) release huge quantities of energy into the interstellar medium, potentially clearing the surrounding gas. The most extreme (in terms of speed and energy) of these—the ultrafast outflows—are the subset of X-ray-detected outflows with velocities higher than 10,000 kilometres per second, believed to originate in relativistic (that is, near the speed of light) disk winds a few hundred gravitational radii from the black hole. The absorption features produced by these outflows are variable, but no clear link has been found between the behaviour of the X-ray continuum and the velocity or optical depth of the outflows, owing to the long timescales of quasar variability. Here we report the observation of multiple absorption lines from an extreme ultrafast gas flow in the X-ray spectrum of the active galactic nucleus IRAS 13224-3809, at 0.236 ± 0.006 times the speed of light (71,000 kilometres per second), where the absorption is strongly anti-correlated with the emission of X-rays from the inner regions of the accretion disk. If the gas flow is identified as a genuine outflow then it is in the fastest five per cent of such winds, and its variability is hundreds of times faster than in other variable winds, allowing us to observe in hours what would take months in a quasar. We find X-ray spectral signatures of the wind simultaneously in both low- and high-energy detectors, suggesting a single ionized outflow, linking the low- and high-energy absorption lines. That this disk wind is responding to the emission from the inner accretion disk demonstrates a connection between accretion processes occurring on very different scales: the X-ray emission from within a few gravitational radii of the black hole ionizing the disk wind hundreds of gravitational radii further away as the X-ray flux rises.