The polarization of τ leptons is measured using leptonic and hadronic τ lepton decays in Z → τ + τ− events in proton-proton collisions at √s = 13TeV recorded by CMS at the CERN LHC with an integrated luminosity of 36.3 fb−1. The measured τ− lepton polarization at the Z boson mass pole is Pτ (Z) = −0.144 ± 0.006 (stat) ± 0.014 (syst) = −0.144 ± 0.015, in good agreement with the measurement of the τ lepton asymmetry parameter of Aτ = 0.1439 ± 0.0043 = −Pτ (Z) at LEP. The τ lepton polarization depends on the ratio of the vector to axial-vector couplings of the τ leptons in the neutral current expression, and thus on the effective weak mixing angle sin2 θ eff W, independently of the Z boson production mechanism. The obtained value sin2 θ eff W = 0.2319 ± 0.0008(stat) ± 0.0018(syst) = 0.2319 ± 0.0019 is in good agreement with measurements at e + e− colliders.