New Zealand's bowling attack left it late to break down a determined Pakistan and clinch a breathtaking 101-run win on day five of the first Test at Mount Maunganui.
Mitchell Santner (2-52) took the decisive wicket with four overs to spare as the Black Caps were forced to be patient and take six wickets in the last session to seal a tense victory on the final day on Wednesday.
Pakistan batsman Fawad Alam and captain Mohammad Rizwan pieced together a gritty 165-run fifth-wicket partnership that swallowed up 62 overs from the opening two sessions.
Each of the five Black Caps bowlers claimed two wickets apiece as Neil Wagner (2-55) and Kyle Jamieson (2-35) took the key wickets of Rizwan and Fawad respectively.
Pakistan's tailenders were only 27 balls away from a memorable draw in the first of two Tests when Santner caught and bowled Naseem Shah (one), as the tourists lost 31-6 to finish 271 all out in their second innings.
Chasing 373 for victory, Pakistan resumed on 71-3 and the visitors appeared in some early trouble when Trent Boult (2-72) had Azhar Ali caught behind for 38 on the third ball of the day.
But the pair of Fawad and Rizwan dug in and rode their luck on occasions to reach 137-5 at lunch with Pakistan battling for the draw.
The duo made it to tea at 215-4 and, by the time the partnership was broken after more than 62 overs, Pakistan had reached 240-5 as Jamieson removed Rizwan lbw for 60 runs off 191 balls.
With Pakistan needing a further 133 runs to win, Wagner found the edge and BJ Watling took his 250th Test match catch to end Fawad's resistance for a gritty 102 runs in 353 minutes for 242-6.
Pakistan's lower order began to collapse as Yasir Shah fell to Jamieson – who bowled 26 maidens in the opening Test, only one Black Caps paceman has tallied more in a Test on New Zealand soil (Lance Cairns – 29 against India in 1981) – for a duck, before Watling held his fourth catch of the innings as Wagner removed Faheem Ashraf for 19.
When Shaheen Afridi came in at 259-8, New Zealand were in a race to clear up the tail as Santner trapped Mohammad Abbas (one) lbw and the left-arm spinner finished the job when Naseem fell during a tense finale.