Previous drilling through submerged fossil coral reefs has greatly improved our understanding of the general pattern of sea-level change since the Last Glacial Maximum, however, how reefs responded to these changes remains uncertain. Here we document the evolution of the Great Barrier Reef (GBR), the world’s largest reef system, to major, abrupt environmental changes over the past 30 thousand years based on comprehensive sedimentological, biological and geochronological records from fossil reef cores. We show that reefs migrated seaward as sea level fell to its lowest level during the most recent glaciation (~20.5–20.7 thousand years ago (ka)), then landward as the shelf flooded and ocean temperatures increased during the subsequent deglacial period (~20–10 ka). Growth was interrupted by five reef-death events caused by subaerial exposure or sea-level rise outpacing reef growth. Around 10 ka, the reef drowned as the sea level continued to rise, flooding more of the shelf and causing a higher sediment flux. The GBR’s capacity for rapid lateral migration at rates of 0.2–1.5 m yr−1 (and the ability to recruit locally) suggest that, as an ecosystem, the GBR has been more resilient to past sea-level and temperature fluctuations than previously thought, but it has been highly sensitive to increased sediment input over centennial–millennial timescales.