A measurement is presented of the cross section for the electroweak production of a Z boson and a photon in association with two jets in proton–proton collisions at s=8 TeV. The Z bosons are identified through their decays to electron or muon pairs. The measurement is based on data collected with the CMS detector corresponding to an integrated luminosity of 19.7 fb −1 . The electroweak contribution has a significance of 3.0 standard deviations, and the measured fiducial cross section is 1.86 −0.75 +0.90 (stat) −0.26 +0.34 (syst)±0.05(lumi) fb, while the summed electroweak and quantum chromodynamic total cross section in the same region is observed to be 5.94 −1.35 +1.53 (stat) −0.37 +0.43 (syst)±0.13(lumi) fb. Both measurements are consistent with the leading-order standard model predictions. Limits on anomalous quartic gauge couplings are set based on the Zγ mass distribution.