The standard model of physics is built on the fundamental constants of nature, but it does not provide an explanation for their values, nor require their constancy over space and time. Here we set a limit on a possible cosmological variation of the proton-to-electron mass ratio μ by comparing transitions in methanol observed in the early universe with those measured in the laboratory. From radio-astronomical observations of PKS1830-211, we deduced a constraint of Δμ/μ = (0.0 ± 1.0) × 10(-7) at redshift z = 0.89, corresponding to a look-back time of 7 billion years. This is consistent with a null result.