The production cross-sections of J/ψ mesons in proton-proton collisions at a centre-of-mass energy of s=5 TeV are measured using a data sample corresponding to an integrated luminosity of 9.13±0.18pb−1, collected by the LHCb experiment. The cross-sections are measured differentially as a function of transverse momentum, pT, and rapidity, y, and separately for J/ψ mesons produced promptly and from beauty hadron decays (nonprompt). With the assumption of unpolarised J/ψ mesons, the production cross-sections integrated over the kinematic range 0<pT<20GeV/c and 2.0<y<4.5 are 8.154±0.010±0.283μb for prompt J/ψ mesons and 0.820±0.003±0.034μb for nonprompt J/ψ mesons, where the first uncertainties are statistical and the second systematic. These cross-sections are compared with those at s=8 TeV and 13 TeV, and are used to update the measurement of the nuclear modification factor in proton-lead collisions for J/ψ mesons at a centre-of-mass energy per nucleon pair of sNN=5 TeV. The results are compared with theoretical predictions.