We perform a calculation of inclusive $Z$ boson production in proton-lead collisions at the LHC taking into account the transverse momenta of the initial partons. We use the framework of $k_T$-factorization combining transverse momentum dependent parton distributions (TMDs) with off-shell matrix elements. In order to do it we need to construct appropriate TMDs for lead nuclei which is done using the parton branching method. Our computations are compared with data from CMS taken at $\sqrt{s}=5.02$ TeV. The results are in good agreement with the measurements especially the transverse momentum distribution of the $Z$ boson