The production cross sections for prompt charmed mesons D 0, D +, D ∗ + and Ds+ were measured at mid-rapidity in proton–proton collisions at a centre-of-mass energy s=7TeV with the ALICE detector at the Large Hadron Collider (LHC). D mesons were reconstructed from their decays D 0→ K -π+, D +→ K -π+π+, D ∗ +→ D 0π+, Ds++→K-K+π+, and their charge conjugates.With respect to previous measurements in the same rapidity region, the coverage in transverse momentum (pT) is extended and the uncertainties are reduced by a factor of about two. The accuracy on the estimated total c c ¯ production cross section is likewise improved. The measured pT-differential cross sections are compared with the results of three perturbative QCD calculations.