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.18 pb−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< 20 GeV/c and 2.0 < y < 4.5 areσpromptJ/ψ=8.154±0.010±0.283μb,σnonpromptJ/ψ=0.820±0.003±0.034μb, 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. [Figure not available: see fulltext.].