New Zealand beat Pakistan by 101 runs in the first Test in Mount Maunganui on Wednesday with the final wicket falling with just 27 balls to spare.

Set a target of 373 to win, a 165-run stand for the fifth wicket by Fawad Alam (102) and Mohammad Rizwan (60) kept Pakistan in contention until late in the final session.

But when the pair were dismissed the remaining wickets fell cheaply, although lower-order batsmen Shaheen Afridi and Naseem Shah blocked for more than seven overs before Naseem was sensationally caught and bowled by Mitchell Santner.

“We saw an incredible spell from Kyle and Wags together that did turn the match when it was looking likely to run out into a draw,” Williamson said, adding that with so much at stake he could not contemplate going defensive.

“For us it was trying to win at all costs. Going into that last session we still clearly had that opportunity, as did Pakistan, but in the context of the Test championship losing while trying to win was still a better bet than anything else. It was great coming away with the result and the excitement of finishing so late in the piece obviously adds to that.”

When Jamieson had Rizwan lbw for 60 and Wagner removed Alam for 102, New Zealand were into the tail as Pakistan folded from 240 for four to be all out for 271.

Tail-enders Shaheen Afridi and Naseem Shah kept the draw option alive as long as they could, blocking for seven overs in fading light before Naseem was caught and bowled by spinner Mitchell Santner for one, ending Pakistan’s resistance.

Pakistan captain Rizwan said that despite the result, he was proud of the way his side played. “We put in hard work, but you must give credit to the New Zealand team,” he said.

Jamieson struck first, 11 overs after the tea break, with the wicket of Rizwan, lbw for 60, before Wagner removed Alam for 102.

Jamieson produced a particularly miserly spell after the tea break when he sent down nine overs and took two for four.

Apart from when Pakistan whipped out the New Zealand openers cheaply on day one, the match had been in New Zealand’s control until Rizwan, the stand-in skipper, joined Alam in the middle with Pakistan 75 for four on the final morning.

They occupied the crease for more than 63 overs until Jamieson struck 11 overs into the final session.

Jamieson had gone close to taking a wicket several times previously, and even his lbw shout against Rizwan was turned down before the umpire’s decision was overturned on review.

Alam lasted three more overs until he gloved a Wagner short ball to wicketkeeper BJ Watling down the leg side.

Alam had been discarded by Pakistan in 2009 after three Tests and a best innings of 168, and since his recall this year his highest score was 21 against England in August.

There were a few loose shots early in his innings and a nerve-wracking moment when a ball ricocheted off his arm and bounced dangerously close to the stumps.

Otherwise he staunchly held his own through 269 deliveries before bringing up his century with a four off Wagner – scoring only two more runs off his next 33 balls before his dismissal.

New Zealand’s frontline pace bowlers Tim Southee, Trent Boult, Wagner, Jamieson and Santner each took two wickets.

(With inputs from AFP)