The transverse momentum (pT) distribution of primary charged particles is measured at midrapidity in minimum-bias p–Pb collisions at √sNN=5.02 TeV with the ALICE detector at the LHC in the range 0.15 <pT <50GeV/c. The spectra are compared to the expectation based on binary collision scaling of particle production in pp collisions, leading to a nuclear modification factor consistent with unity for pT larger than 2 GeV/c, with a weak indication of a Cronin-like enhancement for pT around 4 GeV/c. The measurement is compared to theoretical calculations and to data in Pb–Pb collisions at √sNN=2.76 TeV.