The B0s and B0 mixing frequencies, Δms and Δmd, are measured using a data sample corresponding to an integrated luminosity of 1.0 fb−1 collected by the LHCb experiment in pp collisions at a centre of mass energy of 7 TeV during 2011. Around 1.8 × 106 candidate events are selected of the type B0(s) → D−(s)μ+ (+ anything), where about half are from peaking and combinatorial backgrounds. To determine the B decay times, a correction is required for the momentum carried by missing particles, which is performed using a simulation-based statistical method. Associated production of muons or mesons allows us to tag the initialstate flavour and so to resolve oscillations due to mixing. We obtain Δms = (17.93 ± 0.22 (stat) ± 0.15 (syst)) ps−1, Δmd = (0.503 ± 0.011 (stat) ± 0.013(syst)) ps−1. The hypothesis of no oscillations is rejected by the equivalent of 5.8 standard deviations for B0s and 13.0 standard deviations for B0. This is the first observation of B0s mixing to be made using only semileptonic decays.