Galactic cosmic rays reach energies of at least a few petaelectronvolts1 (of the order of 1015 electronvolts). This implies that our Galaxy contains petaelectronvolt accelerators (‘PeVatrons’), but all proposed models of Galactic cosmic-ray accelerators encounter difficulties at exactly these energies2. Dozens of Galactic accelerators capable of accelerating particles to energies of tens of teraelectronvolts (of the order of 1013 electronvolts) were inferred from recent γ-ray observations3. However, none of the currently known accelerators—not even the handful of shell-type supernova remnants commonly believed to supply most Galactic cosmic rays—has shown the characteristic tracers of petaelectronvolt particles, namely, power-law spectra of γ-rays extending without a cut-off or a spectral break to tens of teraelectronvolts4. Here we report deep γ-ray observations with arcminute angular resolution of the region surrounding the Galactic Centre, which show the expected tracer of the presence of petaelectronvolt protons within the central 10 parsecs of the Galaxy. We propose that the supermassive black hole Sagittarius A* is linked to this PeVatron. Sagittarius A* went through active phases in the past, as demonstrated by X-ray outbursts5and an outflow from the Galactic Centre6. Although its current rate of particle acceleration is not sufficient to provide a substantial contribution to Galactic cosmic rays, Sagittarius A* could have plausibly been more active over the last 106–107 years, and therefore should be considered as a viable alternative to supernova remnants as a source of petaelectronvolt Galactic cosmic rays.