We present a measurement of inclusive J/psi production in p-Pb collisions at root S-NN = 5.02 TeV as a function of the centrality of the collision, as estimated from the energy deposited in the Zero Degree Calorimeters. The measurement is performed with the ALICE detector down to zero transverse momentum, p(T), in the backward (-4.46 <y(cms) <-2.96) and forward (2.03 <y(cms) <3.53) rapidity intervals in the dimuon decay channel and in the mid-rapidity region (-1.37 <y(cms) <0.43) in the dielectron decay channel. The backward and forward rapidity intervals correspond to the Pb-going and p-going direction, respectively. The p(T)-differential J/psi production cross section at backward and forward rapidity is measured for several centrality classes, together with the corresponding average p(T) and p(T)(2) values. The nuclear modification factor is presented as a function of centrality for the three rapidity intervals, and as a function of p(T) for several centrality classes at backward and forward rapidity.