Using 34.7 pb-1 of data collected with the LHCb detector, the inclusive production of the X(3872) meson in pp collisions at sqrt(s) = 7 TeV is observed for the first time. Candidates are selected in the X(3872) -> J/psi pi+ pi- decay mode, and used to measure sigma(pp -> X(3872) + anything) B(X(3872)-> J/psi pi+ pi-) = 5.4 +- 1.3 (stat) +- 0.8 (syst) nb, where sigma(pp -> X(3872) + anything) is the inclusive production cross-section of X(3872) mesons with rapidity in the range 2.5-4.5 and transverse momentum in the range 5-20 GeV/c. In addition the masses of both the X(3872) and psi(2S) mesons, reconstructed in the J/psi pi+ pi- final state, are measured to be m(X(3872)) = 3871.95 +- 0.48 (stat) +- 0.12 (syst) MeV/c2 and m(psi(2S)) = 3686.12 +- 0.06 (stat) +- 0.10 (syst) MeV/c2