Measurements of the total and differential cross sections dσ/dpTB and dσ/dyB for B+mesons produced in pp collisions at √s=7TeV are presented. The data correspond to an integrated luminosity of 5.8pb-1 collected by the CMS experiment operating at the LHC. The exclusive decay B+→J/ψK+, with J/ψ→μ+μ-, is used to detect B+mesons and to measure the production cross section as a function of pTB and yB. The total cross section for pTB>5GeV and |yB|<2.4 is measured to be 28.1±2.4±2.0±3.1μb, where the first uncertainty is statistical, the second is systematic, and the last is from the luminosity measurement. © 2011 American Physical Society.