Understanding why the expansion of the universe is presently accelerating is one of the most important open questions in modern cosmology. In this work we show that the presence of a temporal electromagnetic field on cosmological scales generates an effective cosmological constant which could be responsible for the acceleration. Primordial electromagnetic quantum fluctuations produced during electroweak scale inflation could naturally explain the presence of this field and the measured value of the dark energy density. This mechanism could be discriminated from a true cosmological constant by observations of CMB and structure formation. In the same way as the presence of matter or radiation in the Universe breaks global Lorentz symmetry, the existence of dark energy could be signalling the breakdown of electromagnetic gauge invariance on cosmological scales.