Auckland: New Zealand pulled off a dramatic win by an innings and 49 runs over England in Auckland on Monday, wrapping up the rain-affected first Test with 18.5 overs to spare.
It is only the 10th time New Zealand have beaten England in the 102-Test history between the two countries.
As fortunes fluctuated on the final day in scenes reminiscent of the cliffhanger finish the last time the two sides met on Eden Park, five years ago, Ben Stokes lined himself up to be the hero England so desperately needed.
But with his dismissal for 66 on the stroke of dinner in the day-night Test, New Zealand went into the final session with the task of mopping up the last three wickets, while England still needed 69 runs to makes New Zealand bat again.
Five days after all seemed lost for England when they were rolled for a paltry 58 in their first innings, New Zealand settled the outcome with the tourists all out for 320.
For three consecutive sessions in England's second innings, New Zealand changed the flow of the match with a wicket in the final over.
Joe Root went at stumps on day four to have England 132 for three, Moeen Ali fell at tea on day five after adding 36 runs with Stokes, and then Stokes went at dinner ending an 83-run stand with Chris Woakes.
Five years ago to the day England lost Ian Bell in the last over before tea to be seven down going into the last session, but then they had a battling Matt Prior to save the day as they survived until stumps with one wicket remaining.
This time there would be no such heroics as Stokes, returning from exile after being dropped before the Ashes series following a nightclub altercation in England, saw his effort to snatch an unexpected draw end after 188 deliveries.
A stubborn stand for two sessions folded when he lost patience during a lengthy spell of short-pitched bowling from Neil Wagner — New Zealand's go-to bowler when wickets are hard to come by — and clipped a rising ball to Tim Southee at point.
Wagner, Todd Astle and Trent Boult all finished with three wickets.
When New Zealand declared their first innings at 427 for eight on Sunday, after almost two full days were lost because of rain, England faced a target of 369 to avoid an innings defeat.
They resumed the final day needing 237 and lost Dawid Malan early in the fifth over.
Stokes and Jonny Bairstow cautiously advanced the score to 181 in a partnership of 39 off 128 deliveries before Bairstow was out to another acrobatic catch by a flying Williamson for 26.
Ali was lbw to Boult with the umpire initially ruling in favour of the batsman before the decision was overturned on review.
Craig Overton could only manage three, Woakes went on to 52 before he fended a Wagner delivery to Henry Nicholls and the match ended when Astle had James Anderson caught at mid-off by Boult.
The second Test starts in Christchurch on Friday.
Find latest and upcoming tech gadgets online on Tech2 Gadgets. Get technology news, gadgets reviews & ratings. Popular gadgets including laptop, tablet and mobile specifications, features, prices, comparison.
Pakistan, on top for most of this match, were 137-8 in their second innings at stumps on the third day — a lead of 244 runs.
Woakes finished the match with an edged boundary off Afridi down to the third man rope as England went 1-0 up in a three-match campaign.
Left-hander Masood's first-innings knock of 156 had helped Pakistan take a 107-run first innings lead, while all-rounder Woakes' 84 helped England chase down the 277-run target.