Starting the final session at 191 for six, New Zealand had no chance of chasing down 382 for victory but bowlers Ish Sodhi and Neil Wagner produced a terrific eighth wicket partnership to defy England.
Wagner was out in the final over, caught at silly point off England captain Joe Root, after a DRS review and the umpires then ended the match due to the poor light.
The closing overs were played out to a ring of up to nine close catchers surrounding the batsmen through all England's attempts to separate them until the very end.
"I'm rapt to be part of a series win," said Sodhi. "Waggy is a fighter when he bowls and he dragged me along. There were tough periods when they bowled bouncers but it was a pretty true wicket.
"I was disappointed with my performance with the ball so to be able to contribute is massive for me. All I could hear was the Barmy Army at the end, their songs will be ringing in my head for a while."
The result means New Zealand end the test season with three wins and a draw and might earn them a climb to third on the International Cricket Council test standings, depending on the result of South Africa's test against Australia to be decided overnight.
It is New Zealand's fourth test series win over England and extended to a record 13 the number of away tests England have played without a victory, dating back to Chittagong in 2016.
New Zealand lost just one wicket in the final session.
Allrounder Colin de Grandhomme, who had done well getting to 45 in 137 minutes, momentarily lost the plot and hooked a catch to fine leg, slamming his bat on the ground in disbelief.
However, Sodhi and Wagner were up to the job, batting 107 minutes together. Wagner made 7 off 103 deliveries.
The pitch steadily deadened and although Root tried everything, switching ends with the bowlers and unusual field placings, England couldn't find a way through.
Having started the day at 42 for none, chasing 382 for an unlikely victory, New Zealand were in trouble early, losing two wickets to the first two balls of the day and by tea were 191 for six with 39 overs left.
Sodhi had been promoted ahead of Tim Southee, who has been battling a viral complaint.
New Zealand lost four wickets in the first session but as opener Tom Latham and wicketkeeper BJ Watling, two noted battlers, dug in hopes lifted that they could engineer a revival.
However Watling went to a catch at leg slip by James Anderson off a short ball from fast bowler Mark Wood at 19.
Then Latham, having got to 83, misjudged a sweep shot and was well caught low down by James Vince running in from deep square leg off left arm spinner James Leach.
Latham had batted 282 minutes and faced 207 balls in his defiant struggle.
In the morning session, seamer Stuart Broad, who had already had a fine game taking six for 54 in New Zealand's first innings, started the day with a roar.
First ball Jeet Raval casually turned a catch to mid wicket; second ball came whoops of delight as captain Kane Williamson touched a catch to wicketkeeper Jonny Bairstow off a fine delivery which moved away to take the edge of his bat.
It was Williamson's seventh test duck, but the first time he has been dismissed by his first ball in his 116th test innings. Such is his importance to this team's batting effort, you could feel the air coming out of the New Zealand balloon.
Worse followed soon after when Ross Taylor, who has had an ordinary series, gently swept debutant left arm spinner Jack Leach to backward square leg for the Somerset bowler's first test wicket. Alastair Cook had been moved there the ball before and took the catch. It was a poor shot at any time, let alone given the state of the innings.
Henry Nicholls, coming off a duck in the first innings, got to 13 before lavishly aiming a drive at James Anderson and edging to first slip.
At 91 for four New Zealand were in a parlous state. But the fight had been carried into the final session of the season and the nail-biting conclusion to the international summer.