The production cross-sections of J/ψ mesons in proton-proton collisions at a centre-of-mass energy of sqrt{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,\\documentclass[12pt]{minimal}\t\t\t\t\\usepackage{amsmath}\t\t\t\t\\usepackage{wasysym}\t\t\t\t\\usepackage{amsfonts}\t\t\t\t\\usepackage{amssymb}\t\t\t\t\\usepackage{amsbsy}\t\t\t\t\\usepackage{mathrsfs}\t\t\t\t\\usepackage{upgreek}\t\t\t\t\\setlength{\\oddsidemargin}{-69pt}\t\t\t\t\\begin{document}$$ {\\displaystyle \\begin{array}{c}{\\sigma}_{\\mathrm{prompt}}\\ J/\\psi =8.154\\pm 0.010\\pm 0.283\\ \\upmu \\mathrm{b},\\\\ {}{\\sigma}_{\\mathrm{nonprompt}}\\ J/\\psi =0.820\\pm 0.003\\pm 0.034\\ \\upmu \\mathrm{b},\\end{array}} $$\\end{document}where the first uncertainties are statistical and the second systematic. These cross-sections are compared with those at sqrt{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 sqrt{s_{mathrm{NN}}} = 5 TeV. The results are compared with theoretical predictions.