The prompt production of the charmonium $chi_{c1}$ and $chi_{c2}$ mesons has been studied in proton-proton collisions at the Large Hadron Collider at a centre-of-mass energy of $sqrt{s}=7$ TeV. The $chi_c$ mesons are identified through their decays $chi_cto J/psi,gamma$ with $J/psi to mu^+ mu^-$ using 36 $mathrm{pb^{-1}}$ of data collected by the LHCb detector in 2010. The ratio of the prompt production cross-sections for the two $chi_c$ spin states, $sigma(chi_{c2})/sigma(chi_{c1})$, has been determined as a function of the $J/psi$ transverse momentum, $p_{mathrm{T}}^{J/psi}$, in the range from 2 to 15 GeV/$c$. The results are in agreement with the next-to-leading order non-relativistic QCD model at high $p_{mathrm{T}}^{J/psi}$ and lie consistently above the pure leading-order colour singlet prediction.