The top-Z coupling can be probed directly at the LHC through the associated production of top quarks with a Z boson. We will review the main features and theoretical predictions of top pair or single top production in association with a Z boson both in the Standard Model and in the Standard Model Effective Field theory. A measurement of the inclusive and differential ttZ cross section using 77.5/fb of 13 TeV pp collision data collected by the CMS experiment will be presented. The obtained result allows to place improved limits on anomalous top couplings to the Z boson, and improved constraints on Wilson coefficients of the standard model effective theory are extracted.