A search for a heavy resonance decaying into a top quark and antiquark (tt) pair is performed using proton-proton collisions at p s = 13TeV. The search uses the data set collected with the CMS detector in 2016, which corresponds to an integrated luminosity of 35.9 fb. The analysis considers three exclusive fi nal states and uses reconstruction techniques that are optimized for top quarks with high Lorentz boosts, which requires the use of nonisolated leptons and jet substructure techniques. No signi fi cant excess of events relative to the expected yield from standard model processes is observed. Upper limits on the production cross section of heavy resonances decaying to a tt pair are calculated. Limits are derived for a leptophobic topcolor Z 0 resonance with widths of 1, 10, and 30%, relative to the mass of the resonance, and exclude masses up to 3.80, 5.25, and 6.65TeV, respectively. Kaluza-Klein excitations of the gluon in the Randall-Sundrum model are excluded up to 4.55TeV. To date, these are the most stringent limits on tt resonances.