The first observation of the electroweak (EW) production of a Z boson, a photon, and two forward jets (Zγjj) in proton-proton collisions at a center-of-mass energy of 13 TeV is presented. A data set corresponding to an integrated luminosity of 137 fb−1, collected by the CMS experiment at the LHC in 2016–2018 is used. The measured fiducial cross section for EW Zγjj is σEW=5.21±0.52(stat)±0.56(syst) fb=5.21±0.76 fb. Single-differential cross sections in photon, leading lepton, and leading jet transverse momenta, and double-differential cross sections in mjj and |Δηjj| are also measured. Exclusion limits on anomalous quartic gauge couplings are derived at 95% confidence level in terms of the effective field theory operators M0 to M5, M7, T0 to T2, and T5 to T9.