Resuming on 4-103 and chasing an unlikely 373 to win, England were dismissed for 212 soon after lunch on the fifth day as New Zealand clinched the series 2-1.
The New Zealanders' other series wins on English soil were in 1986, 1999 and in 2021 - the latter being in a two-match series.
Stokes announced on Sunday he would be stepping down as England captain after four years after this Test, and also retiring from the international game after 15 years with the national team.
He did not have an active role on the final day since he was dismissed for 30 late on Sunday after opening the batting.
"It would have been great to have gone out with a series win and a win," Stokes said, "but that's in a perfect world and this world certainly isn't perfect."
It was England's first defeat in a home series of three or more Tests since 2012. The team have lost seven of their last nine Test matches, a streak that piles the pressure on the leadership team of coach Brendon McCullum and director of cricket Rob Key.
England's final-day hopes realistically rested on Joe Root and Emilio Gay, the remaining specialist batters who resumed from overnight, but they both departed in the fourth over, having walked to the middle with the boundary boards around the ground displaying the message: "Thank you Ben Stokes."
Gay (10) edged behind and Root, England's all-time leading run scorer, was brilliantly run out by Henry Nicholls for 18.
A seventh-wicket stand of 75 between Jamie Smith and Gus Atkinson held up New Zealand's charge before lunch, before Atkinson (19) was trapped lbw by spinner Mitchell Santner.
The end came 15 minutes into the second session, when Smith was dismissed for 60.