Primitive or undifferentiated meteorites (chondrites) date back to the origin of the Solar System, and thus preserve a record of the physical and chemical processes that occurred during the earliest evolution of the accretion disk surrounding the young Sun. The oldest Solar System materials present within these meteorites are millimetre- to centimetre-sized calcium-aluminium-rich inclusions (CAIs) and ferromagnesian silicate spherules (chondrules), which probably originated by thermal processing of pre-existing nebula solids. Chondrules are currently believed to have formed ~2-3 million years (Myr) after CAIs (refs 5-10)-a timescale inconsistent with the dynamical lifespan of small particles in the early Solar System. Here, we report the presence of excess Mg resulting from in situ decay of the short-lived Al nuclide in CAIs and chondrules from the Allende meteorite. Six CAIs define an isochron corresponding to an initial Al/ Al ratio of (5.25 ± 0.10) × 10, and individual model ages with uncertainties as low as ±30,000 years, suggesting that these objects possibly formed over a period as short as 50,000 years. In contrast, the chondrules record a range of initial Al/Al ratios from (5.66 ± 0.80) to (1.36 ± 0.52) × 10, indicating that Allende chondrule formation began contemporaneously with the formation of CAIs, and continued for at least 1.4 Myr. Chondrule formation processes recorded by Allende and other chondrites may have persisted for at least 2-3 Myr in the young Solar System.