A search for a heavy resonance decaying into a top quark and antiquark (t t ¯) pair is performed using proton-proton collisions at s=13 TeV. The search uses the data set collected with the CMS detector in 2016, which corresponds to an integrated luminosity of 35.9 fb −1 . The analysis considers three exclusive final 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 significant 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 t t ¯ pair are calculated. Limits are derived for a leptophobic topcolor Z ′ 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.65 TeV, respectively. Kaluza-Klein excitations of the gluon in the Randall-Sundrum model are excluded up to 4.55 TeV. To date, these are the most stringent limits on t t ¯ resonances.