Pakistan resumed after tea requiring just 86 more runs to win and with five wickets remaining, but the tourists fought back to secure an unlikely victory on a very flat deck as the sun began to set over the stadium.
Coach Brendon McCullum and captain Stokes did not deviate from their attacking and unconventional approach with both bat and ball and were rewarded with a first England away win in 12 Tests on a pitch where just 14 wickets fell across all five days when Australia visited in March.
Stokes claimed it was one of his proudest achievements in an England shirt.
“I think it’s probably one of the best,” he said. “To be able to get a result on this type of wicket is mind-blowing and the effort that everyone has managed to put in this whole week is just incredible.
“I feel very honoured and I feel in a very privileged position to lead these lads out onto the field.
“Jimmy Anderson said to me before the match presentation that he was feeling quite emotional about this win – so to have a guy who has played 180 Test matches, who has experienced absolutely everything, to hear him say that about this Test match – I think that really makes you realise how special this week has been.”
Jack Leach claimed the final wicket of Naseem Shah lbw following a lengthy rearguard effort from Pakistan for the final wicket, with all players surrounding the bat, including one on his knees in any attempt to wrangle a catch.
Spin bowler Leach said he felt like a “fraud” taking the final wicket – the only one to fall to spin in the fourth and final innings of the match.
On the winning moment, he said: “An unbelievable feeling, I’m just so happy we could get over the line.
“It’s felt like a very long game but really rewarding at the end of it to come away with a win and obviously so many good performances from the boys. To finish it off I felt a bit of a fraud to be honest because the quick boys had done the work, but it was amazing.”
England captain Stokes felt “emotional” following England’s hard-fought victory, and added on Sky Sports Cricket: “The amount of effort you put in, especially in the field on day five, you get that huge rush of adrenaline and excitement.
“Twenty minutes later your body starts to get stiff and you feel a bit of a comedown. That’s because of the realisation of what you’ve managed to achieve by winning a Test match on day five.
“It’s hard to explain but it’s something you only really get out of sport and it’s why you absolutely love playing.”
Anderson was in the thick of things in his first Test outing on Pakistani soil, claiming four for 36 in the fourth innings, including two late scalps as bad light threatened to halt the victory push in its tracks.
Asked if he had seen anything like it before, Anderson said: “I don’t think I have actually. It’s probably one of the best wins I’ve been involved in, if not the best.
“On a pitch like that, to play the way we did, to score runs at the rate we did, we gave ourselves a chance to get the result.
“It was an unbelievable effort from everyone. We knew it was going to be difficult, it just feels like with Ben and Brendon (McCullum, head coach), their mantra is ‘we’ve got to take wickets’. We look to take wickets all the time.
“We knew it was a big push, we dug deep to get anything out of that wicket.”