England were battling for survival after Mitchell Santner took three cheap wickets following a match-turning double century by BJ Watling in the first Test against New Zealand in Mount Maunganui on Sunday.
After New Zealand declared at 615 for nine on day four in Mount Maunganui, England were 55 for three at stumps, needing a further 207 on the final day if they are to make the Black Caps bat again.
After more than two days and 201 overs in the field, much of it watching Watling and then Santner take the game away from them, England had an uncomfortable two hours batting with both openers Dom Sibley and Rory Burns falling, followed by nightwatchman Jack Leach from the last ball of the day.
After their marathon batting stint, wicketkeeper Watling and Santner reunited to remove Sibley for 12. The spinner then had Burns for 31 and Leach without scoring in his three for six off 8.4 overs.
It capped a remarkable day for Santner, who earlier posted his maiden Test century during a record-breaking stand with Watling.
Sibley's wicket was the first by a New Zealand spinner on home soil since March 2018 with 101 Test wickets in 11 innings since all falling to seamers.
Burns, batting with a thumb glued together after being split when fielding on Friday, was dropped once at midwicket while another chance fell just short of Tom Latham who had taken the wicketkeeper's gloves at the start of the innings.
When Watling returned to the field he dropped an edge off Sibley although the England opener did not add to his score before he was dismissed, while Latham took a smart catch at forward short leg to remove Leach.
England had their tails up when New Zealand were 197 for five, with the cream of their crop, including the talismanic Kane Williamson, out.
But Watling put New Zealand back on an equal footing in a 116-run partnership with Colin de Grandhomme and then put the home side firmly in charge as he rewrote the record books with Santner.
Both scored Test bests with Watling posting 205, beating his 142 not out against Sri Lanka in 2015, while Santner scored 126 to surpass his 73 against Bangladesh in 2017.
Their 261 for the seventh wicket eclipsed the previous New Zealand record stand of 225 by Chris Cairns and Jacob Oram against South Africa at Eden Park in 2004.
When New Zealand declared soon after Jofra Archer claimed Watling's wicket, the 615 was their highest total against England, going past their 551-9 declared at Lord's in 1973.
Watling faced 473 deliveries and hit 24 fours and a six during more than 11 remarkable hours of batting which extended his unbroken time in the middle to 16 hours 16 minutes after he batted for 306 minutes to score an unbeaten 105 in his last Test innings against Sri Lanka three months ago.
Sam Curran, who claimed Santner's wicket, finished with three for 119