New Zealand's bowlers produced a late final session surge to guide their side to a tense 101-run victory over Pakistan in the first test in Mount Maunganui and kept alive their hopes of reaching next year's World Test Championship final.
Pakistan were dismissed for 271, chasing a victory target of 372, with 4.3 overs remaining in the test at Bay Oval.
New Zealand had been hot favourites to win the game as the final day started with the tourists 71-3 but a 165-run partnership between Fawad Alam and Mohammad Rizwan gave the tourists a chance of a draw, if not an unlikely victory.
"It was a brilliant game," New Zealand captain Kane Williamson said. "Both teams put their best foot forward and Pakistan were incredibly resilient in that second innings, but the boys kept coming.
"A huge effort by the bowlers to get us across the line."
Fawad, who was on 21 runs overnight, pushed on to score the second Test century of his career - 11 years after he had scored his first.
Fawad scored his first Test hundred against Sri Lanka on debut in 2009 and after a period of time out of the Pakistan team he played with grit and determination for his 102 off 269 deliveries.
The partnership between Fawad and stand-in captain Rizwan (60), who scored his fourth consecutive Test 50, frustrated the Black Caps bowlers.
Kyle Jamieson ended the partnership when he had Rizwan trapped in front, albeit after a review, for 60, and that left Pakistan 242-6, still 131 runs away from their target with 25 overs remaining.
He also had Yasir Shah caught in the gully for a duck, while Neil Wagner, who has played the last three days with two broken toes, had Fawad caught by wicketkeeper BJ Watling for 102 and then Faheem Ashraf for 19 to expose the tail.
Mitchell Santner then trapped Mohammad Abbas in front for one, before he captured the last wicket when he had Nassem Shah caught and bowled for one with 4.3 overs remaining in the test.
"Not a huge disappointment (with the result)," Rizwan said. "That's test cricket.
"We lost this match, but we're still in the series."
New Zealand has now won five Test matches in a row.
The second match in the two-test series is at Christchurch's Hagley Oval from 3 January and New Zealand need to win that game as well to give them any chance of making the Test Championship final at Lord's.
Look back at the day five commentary.
- Reuters/RNZ