The standard model of particle physics describes the fundamental particles and their interactions via the strong, electromagnetic and weak forces. It provides precise predictions for measurable quantities that can be tested experimentally. The probabilities, or branching fractions, of the strangeB meson (B0 s ) andtheB0meson decaying into two oppositely charged muons (μ+ and μ-) are especially interesting because of their sensitivity to theories that extend the standard model. The standard model predicts that the B0 s→μ+μ- and B0 s→μ+μ- decays are very rare, with about four of the former occurring for every billion B0 s mesons produced, and one of the latter occurring for every ten billion B0 mesons1. A difference in the observed branching fractions with respect to the predictions of the standard model would provide a direction in which the standard model should be extended. Before the Large Hadron Collider (LHC) at CERN2 started operating, no evidence for either decay mode had been found. Upper limits on the branching fractions were an order of magnitude above the standard model predictions. The CMS (CompactMuonSolenoid) andLHCb(LargeHadronCollider beauty) collaborations have performed a joint analysis of the data from proton'proton collisions that they collected in 2011 at a centre-ofmass energy of seven teraelectronvolts and in 2012 at eight teraelectronvolts. Here we report the first observation of the B0 s→μ+μ- decay, with a statistical significance exceeding six standard deviations, and the best measurement so far of its branching fraction. Furthermore, we obtained evidence for the B0 s→μ+μ- decay with a statistical significance of three standard deviations. Both measurements are statistically compatible with standard model predictions and allow stringent constraints to be placed on theories beyond the standardmodel. The LHCexperimentswill resume taking data in 2015, recording proton'proton collisions at a centre-of-mass energy of 13 teraelectronvolts, which will approximately double the production rates of B0 s and B0 mesons and lead to further improvements in the precision of these crucial tests of the standard model.