The inclusive production of the ψ(2S) charmonium state was studied as a function of centrality in p-Pb collisions at the nucleon-nucleon center of mass energy √sNN=5.02 TeV at the CERN LHC. The measurement was performed with the ALICE detector in the center of mass rapidity ranges −4.46 < ycms< −2.96 and 2.03 < ycms< 3.53, down to zero transverse momentum, by reconstructing the ψ(2S) decay to a muon pair. The ψ(2S) production cross section σψ(2S) is presented as a function of the collision centrality, which is estimated through the energy deposited in forward rapidity calorimeters. The relative strength of nuclear effects on the ψ(2S) and on the corresponding 1S charmonium state J/ψ is then studied by means of the double ratio of cross sections [σψ(2S)/σJ/ψ]pPb/[σψ(2S)/σJ/ψ]pp between p-Pb and pp collisions, and by the values of the nuclear modification factors for the two charmonium states. The results show a large suppression of ψ(2S) production relative to the J/ψ at backward (negative) rapidity, corresponding to the flight direction of the Pb-nucleus, while at forward (positive) rapidity the suppressions of the two states are comparable. Finally, comparisons to results from lower energy experiments and to available theoretical models are presented.