Mohammad Rizwan celebrated his elevation to the Pakistan Test captaincy in style, smashing a career-best 89 to stop New Zealand claiming a series sweep in the third Twenty20 in Napier.
Pakistan reached New Zealand's target of 174 with two balls to spare, ending on 177 after Iftikhar Ahmed sealed the win with a six in the final over.
But it was Rizwan's 89 from 59 balls, with support from 41-run Mohammad Hafeez, that inspired the victory.
It was a hard-fought win for the tourists, who suffered heavy defeats in the two opening matches after a rocky preparation that included Covid-19 quarantine in Christchurch with no training.
The win was particularly sweet for Rizwan, who was named on Monday as captain for the first Test against New Zealand starting December 26 after regular skipper Babar Azam was ruled out with a broken thumb.
"I never thought I'd be made the captain of Pakistan and I can't explain my happiness," he said after his man-of-the-match T20 performance.
Rizwan said the T20 victory was an important morale booster ahead of the two-Test series against the Black Caps.
"We want to take momentum from this into the Test match, so this is very important for us," he said.
After two losses when batting first, Pakistan changed tactics and opted to bowl when they won the toss, restricting New Zealand to 173 for seven, with Devon Conway top-scoring on 63.
Faheem Ashraf was the pick of the Pakistan attack, taking three for 20.
The strategy of chasing down New Zealand's total paid off as Rizwan and Hafeez forged a 72-run partnership that laid the foundation for the win.
Hafeez, who was stranded on 99 in Hamilton, made 41 from 29 balls including three sixes.
Rizwan's innings, the sixth-highest by a Pakistan batsman in T20s, included a booming six that bounced off the roof of a stand and out of the ground, forcing the umpires to select a replacement ball.
Daryl Mitchell, on as a fielding substitute for the injured Martin Guptill, took three catches for the Black Caps and Pakistan made a nervy finish to the match.
But the solid start to the innings ensured the middle order had enough breathing space to steer the tourists home.