A discovery of the rare decay B+→π+μ+μ− is presented. This decay is observed for the first time, with 5.2 σ significance. The observation is made using pp collision data, corresponding to an integrated luminosity of 1.0 fb−1, collected with the LHCb detector. The measured branching fraction is (2.3 ± 0.6 (stat.) ± 0.1 (syst.))×10−8, and the ratio of the B+→π+μ+μ− and B+→\K+μ+μ− branching fractions is measured to be 0.053 ± 0.014 (stat.) ± 0.001 (syst.).