This Letter reports a measurement of the muon charge asymmetry from W bosons produced in proton– proton collisions at a centre-of-mass energy of 7 TeV with the ATLAS experiment at the LHC. The asymmetry is measured in the W → μν decay mode as a function of the muon pseudorapidity using a data sample corresponding to a total integrated luminosity of 31 pb−1. The results are compared to predictions based on next-to-leading order calculations with various parton distribution functions. This measurement provides information on the u and d quark momentum fractions in the proton.