Angular correlations in B+→X(3872)K+ decays, with X(3872)→ρ0J/ψ, ρ0→π+π- and J/ψ→μ+μ-, are used to measure orbital angular momentum contributions and to determine the JPC value of the X(3872) meson. The data correspond to an integrated luminosity of 3.0fb-1 of proton-proton collisions collected with the LHCb detector. This determination, for the first time performed without assuming a value for the orbital angular momentum, confirms the quantum numbers to be JPC=1++. The X(3872) is found to decay predominantly through an S wave and an upper limit of 4% at 95% C.L. is set on the D-wave contribution.