The Solar System’s orbital structure is thought to have been sculpted by a dynamical instability among the giant planets[1–4]. Yet the instability trigger and exact timing have proved hard to pin down[5–9]. The giant planets formed within a gas-dominated disk around the young Sun. Motivated by giant exoplanet systems found in mean motion resonance[10], hydrodynamical modeling has shown that while the disk was present the giant planets migrated into a compact orbital configuration, in a chain of resonances[2,11]. Here we use a suite of dynamical simulations to show that the giant planets’ instability was likely triggered by the dispersal of the Sun’s gaseous disk. As the disk evaporated from the inside-out, its inner edge swept successively across and dynamically perturbed each planet’s orbit in turn. Saturn and each ice giants’ orbits were torqued strongly enough to migrate outward. As a given planet migrated outward with the disk’s inner edge the orbital configuration of the exterior system was compressed, triggering dynamical instability. The final orbits of our simulated systems match those of the Solar System for a viable range of astrophysical parameters. Our results demonstrate that the giant planet instability happened as the gaseous disk dissipated, constrained by astronomical observations to be a few to ten million years after the birth of the Solar System [12]. Late-stage terrestrial planet formation would occur mostly after such an early giant planet instability [13,14], thereby avoiding the possibility of de-stabilizing the terrestrial planets [15] and naturally accounting for the small mass of Mars relative to Earth and the mass depletion of the main asteroid belt [16].