The W and Z boson production was measured via the muonic decay channel in proton-lead collisions at root s(NN) = 5.02 TeV at the Large Hadron Collider with the ALICE detector. The measurement covers backward (4.46 <y(cms) <2.96) and forward (2.03 <y(cms) <3.53) rapidity regions, corresponding to Pb-going and p-going directions, respectively. The Z-boson production cross section, with dimuon invariant mass of 60 <m(mu mu) <120 GeV/c(2) and muon transverse momentum (p(T)(mu)) larger than 20 GeV/c, is measured. The production cross section and charge asymmetry of muons from W-boson decays with p(T)(mu) > 10 GeV/c are determined. The results are compared to theoretical calculations both with and without including the nuclear modification of the parton distribution functions. The W-boson production is also studied as a function of the collision centrality: the cross section of muons from W-boson decays is found to scale with the average number of binary nucleon-nucleon collisions within uncertainties.