A search is performed for a vector-like heavy T quark that is produced in pairs and that decays to a top quark and a Higgs boson. The data analysed correspond to an integrated luminosity of 19.7 fb(-1) collected with the CMS detector in proton-proton collisions at root s = 8TeV. For T quarks with large mass values the top quarks and Higgs bosons can have significant Lorentz boosts, so that their individual decay products often overlap and merge. Methods are applied to resolve the substructure of such merged jets. Upper limits on the production cross section of a T quark with mass between 500 and 1000 GeV/c(2) are derived. If the T quark decays exclusively to tH, the observed (expected) lower limit on the mass of the T quark is 745 (773) GeV/c(2) at 95% confidence level. For the first time an algorithm is used for tagging boosted Higgs bosons that is based on a combination of jet substructure information and b tagging.