A measurement is presented of W-boson production in PbPb collisions carried out at a nucleon-nucleon (NN) centre-of-mass energy root S-NN of 2.76 TeV at the LHC using the CMS detector. In data corresponding to an integrated luminosity of 7.3 mu b(-1), the number of W -> mu v(mu) decays is extracted in the region of muon pseudorapidity vertical bar eta mu vertical bar < 2.1 and transverse momentum p(T)(mu) > 25 GeV/c. Yields of muons found per unit of pseudorapidity correspond to (159 +/- 10(stat.) +/- 12(syst.)) x 10(-8) W and (154 +/- 10(stat.) +/- 12(syst.)) x 10(-8) W- bosons per minimum-bias PbPb collision. The dependence of W production on the centrality of PbPb collisions is consistent with a scaling of the yield by the number of incoherent NN collisions. The yield of W bosons is also studied in a sample of pp interactions at root S = 2.76 TeV corresponding to an integrated luminosity of 231 nb(-1). The individual W+ and W- yields in PbPb and pp collisions are found to agree, once the neutron and proton content in Pb nuclei is taken into account. Likewise, the difference observed in the dependence of the positive and negative muon production on pseudorapidity is consistent with next-to-leading-order perturbative QCD calculations. (c) 2012 CERN. Published by Elsevier B.V. All rights reserved.