A measurement of the CP asymmetry in B+→K+μ+μ− decays is presented using pp collision data, corresponding to an integrated luminosity of 1.0 fb−1, recorded by the LHCb experiment during 2011 at a center-of-mass energy of 7 TeV. The measurement is performed in seven bins of μ+μ− invariant mass squared in the range 0.05<q2<22.00 GeV2/c4, excluding the J/ψ and ψ(2S) resonance regions. Production and detection asymmetries are corrected for using the B+→J/ψK+ decay as a control mode. Averaged over all the bins, the CP asymmetry is found to be ACP=0.000±0.033 (stat)±0.005 (syst)±0.007 (J/ψK), where the third uncertainty is due to the CP asymmetry of the control mode. This is consistent with the standard model prediction.