The ATLAS Collaboration measures the inclusive production of Z bosons via their decays into electron and muon pairs in p+Pb collisions at sNN=5.02TeV at the Large Hadron Collider. The measurements are made using data corresponding to integrated luminosities of 29.4 and 28.1 nb-1 for Z→ee and Z→μμ, respectively. The results from the two channels are consistent and combined to obtain a cross section times the Z→ℓℓ branching ratio, integrated over the rapidity region |yZ∗|<3.5, of 139.8±4.8(statistical)±6.2(systematic)±3.8 (luminosity) nb. Differential cross sections are presented as functions of the Z boson rapidity and transverse momentum and compared with models based on parton distributions both with and without nuclear corrections. The centrality dependence of Z boson production in p+Pb collisions is measured and analyzed within the framework of a standard Glauber model and the model's extension for fluctuations of the underlying nucleon-nucleon scattering cross section.