A measurement of the production cross-section for Z bosons that decay to muons is presented. The data were recorded by the LHCb detector during pp collisions at a centre-of-mass energy of 7 TeV, and correspond to an integrated luminosity of 1.0 fb−1. The cross-section is measured for muons in the pseudorapidity range 2.0 < η < 4.5 with transverse momenta pT> 20 GeV/c. The dimuon mass is restricted to 60 < Mμ+μ− < 120 GeV/c2. The measured cross-section is (Formula presented.) where the uncertainties are due to the sample size, systematic effects, the beam energy and the luminosity. This result is in good agreement with theoretical predictions at next-to-next-to-leading order in perturbative quantum chromodynamics. The cross-section is also measured differentially as a function of kinematic variables of the Z boson. Ratios of the production cross-sections of electroweak bosons are presented using updated LHCb measurements of W boson production. A precise test of the Standard Model is provided by the measurement of the ratio (Formula presented.) where the uncertainty due to luminosity cancels.