The discovery of extraterrestrial very-high-energy neutrinos by the IceCube collaboration has launched a quest for the identification of their astrophysical sources. Gamma-ray blazars have been predicted to yield a cumulative neutrino signal exceeding the atmospheric background above energies of 100 TeV, assuming that both the neutrinos and the gamma-ray photons are produced by accelerated protons in relativistic jets. Since the background spectrum falls steeply with increasing energy, the individual events with the clearest signature of being of an extraterrestrial origin are those at PeV energies. Inside the large positional-uncertainty fields of the first two PeV neutrinos detected by IceCube, the integrated emission of the blazar population has a sufficiently high electromagnetic flux to explain the detected IceCube events, but fluences of individual objects are too low to make an unambiguous source association. Here, we report that a major outburst of the blazar PKS B1424-418 occurred in temporal and positional coincidence with the third PeV-energy neutrino event (IC35) detected by IceCube. Based on an analysis of the full sample of gamma-ray blazars in the IC35 field and assuming a photo-hadronic emission model, we show that the long-term average gamma-ray emission of blazars as a class is in agreement with both the measured all-sky flux of PeV neutrinos and the spectral slope of the IceCube signal. The outburst of PKS B1424-418 has provided an energy output high enough to explain the observed PeV event, indicative of a direct physical association.