The differential production cross sections of B± mesons are measured via the exclusive decay channels B±→J/ψK±→μ+μ-K± as a function of transverse momentum in pp and Pb-Pb collisions at a center-of-mass energy sNN=5.02 TeV per nucleon pair with the CMS detector at the LHC. The pp(Pb-Pb) data set used for this analysis corresponds to an integrated luminosity of 28.0 pb-1 (351 μb-1). The measurement is performed in the B± meson transverse momentum range of 7 to 50 GeV/c, in the rapidity interval |y|<2.4. In this kinematic range, a strong suppression of the production cross section by about a factor of 2 is observed in the Pb-Pb system in comparison to the expectation from pp reference data. These results are found to be roughly compatible with theoretical calculations incorporating beauty quark diffusion and energy loss in a quark-gluon plasma.