In this letter, the production of deuterons and anti-deuterons in pp collisions at √s = 7 TeV is studied as a function of the charged-particle multiplicity density at mid-rapidity with the ALICE detector at the LHC. Production yields are measured at mid-rapidity in five multiplicity classes and as a function of the deuteron transverse momentum (pT). The measurements are discussed in the context of hadron–coalescence models. The coalescence parameter B2, extracted from the measured spectra of (anti-)deuterons and primary (anti-)protons, exhibits no significant pT-dependence for pT < 3 GeV/c, in agreement with the expectations of a simple coalescence picture. At fixed transverse momentum per nucleon, the B2 parameter is found to decrease smoothly from low multiplicity pp to Pb–Pb collisions, in qualitative agreement with more elaborate coalescence models. The measured mean transverse momentum of (anti-)deuterons in pp is not reproduced by the Blast-Wave model calculations that simultaneously describe pion, kaon and proton spectra, in contrast to central Pb–Pb collisions. The ratio between the pT-integrated yield of deuterons to protons, d/p, is found to increase with the charged particle multiplicity, as observed in inelastic pp collisions at different centre-of-mass energies. The d/p ratios are reported in a wide range, from the lowest to the highest multiplicity values measured in pp collisions at the LHC.