Measurements of both the inclusive and differential production cross sections of a top-quark–antiquark pair in association with a Z boson ($$t{\bar{t}}Z$$
t
t
¯
Z
) are presented. The measurements are performed by targeting final states with three or four isolated leptons (electrons or muons) and are based on $$\sqrt{s} = 13$$
s
=
13
TeV proton–proton collision data with an integrated luminosity of 139 $$\hbox {fb}^{-1}$$
fb
-
1
, recorded from 2015 to 2018 with the ATLAS detector at the CERN Large Hadron Collider. The inclusive cross section is measured to be $$\sigma _{t{\bar{t}}Z} = 0.99 \pm 0.05$$
σ
t
t
¯
Z
=
0.99
±
0.05
(stat.) $$\pm \, 0.08$$
±
0.08
(syst.) pb, in agreement with the most precise theoretical predictions. The differential measurements are presented as a function of a number of kinematic variables which probe the kinematics of the $$t{\bar{t}}Z$$
t
t
¯
Z
system. Both absolute and normalised differential cross-section measurements are performed at particle and parton levels for specific fiducial volumes and are compared with theoretical predictions at different levels of precision, based on a $$\chi ^{2}/$$
χ
2
/
ndf and p value computation. Overall, good agreement is observed between the unfolded data and the predictions.