England 657 (Brook 153, Crawley 122, Pope 108, Duckett 107) and 264 for 7 dec (Brook 87, Root 73, Crawley 50) beat Pakistan 579 (Babar 136, Imam 121, Shafique 114, Jacks 6-161) and 268 (Shakeel 76, Anderson 4-36, Robinson 4-50) by 74 runs
A win's a win, right? Nope. England can understandably be ultra tubthumping in their celebrations of a 74-run victory for the ages on the final evening of a remarkable Test against Pakistan in Rawalpindi.
On a pitch that yielded 1768 runs for the match, the third-highest aggregate in history, the visitors' bold declaration at tea on the penultimate day gave them four sessions in which to claim 10 wickets with Pakistan needing 343 to win.
It went down to the wire, with five wickets still needed after tea on Monday and a quick-sinking sun making its way ominously towards the horizon.
But Ben Stokes and his men grasped the challenge and two wickets in two overs by Player of the Match Ollie Robinson, followed by two wickets in as many balls to James Anderson gave them the stranglehold they needed.
Robinson and Anderson took four wickets each in Pakistan's second innings but it was spinner Jack Leach who clinched the final one - that of Naseem Shah - with what could only have been minutes remaining to seal victory in England's first Test appearance in Pakistan for 17 years.
Centuries to newcomer Harry Brook, Zak Crawley, Ollie Pope and Ben Duckett - returning after six years outside the Tests fold - in England's record first innings of 657 were brought into context on the flattest of tracks as Pakistan produced three of their own in containing the tourists' advantage to 78 runs, Will Jacks claiming six wickets on debut. Then came another Brook star turn, his rapid-fire 87 off 65 balls the highlight of England's second innings, upstaged only by the Stokes' surprise decision to declare.
But it all came down to the last day - and the final 90 minutes of it.
Having finally coaxed an aging ball to reverse after lunch, England were vindicated in their decision not to take the new one which became available three overs after tea.
With Agha Salman and Azhar Ali having settled into a half-century stand for the fifth wicket and Pakistan needing another 86 runs for victory in the final session, Robinson trapped Salman without adding to his tea-time score of 30 with an inswinger that pinned him back in his crease and England overturned the initial not-out decision when ball-tracking confirmed he was on target.
On the next ball, Robinson was left in disbelief when his inswinger shaved the outside of Naseem Shah's off stump about a third of the way up but the bails stayed put. It wasn't long, however, before he had Azhar caught at leg slip by Joe Root trying to flick another inswinger off his hip.
Stokes produced a typically gutsy haul with the ball in support of his two main seamers and Anderson capitalised with two quick wickets late in the day. He dismissed Zahid Mahmood to a wonderful diving catch down the leg side by Pope, standing in as wicketkeeper for Ben Foakes, who had failed to recover from the stomach bug that hit the England camp on the eve of the match.
Two balls later, Anderson rapped Haris Rauf on the pads with a full inswinger. Rauf, who will miss the next Test in Multan with a quad strain suffered during this match, called for the DRS in vain, his dismissal upheld on umpire's call.
Naseem rode his luck, edging Stokes between Pope and Root at first slip as he and Mohammad Ali staged critical half-an-hour worth of resistance with their final-wicket stand.
Stokes finally took the second new ball with the light fading fast and it was Leach who sealed the win when he pinned Naseem on the front pad, the batter's hopeful review only adding momentary delay to the tourists unleashing their full-blown jubilation.
England claimed just one wicket in the morning session, that of Imam-ul-Haq, who had steadied his side from 25 for 2 on the fourth day but added only five to his overnight 43 before he was strangled down the leg side by Anderson.
Mohammad Rizwan and Saud Shakeel took to England's spinners during the morning session as Pakistan added 89 runs to their overnight 80 for 2 after scoring just 13 in the first hour. So Stokes entered the fray in the first over after lunch and managed to find some reverse swing, which Anderson exploited to devastating effect.
Anderson removed the dangerous Rizwan on 46 with one that reversed just enough and found an edge that flew through to Pope, ending an 87-run stand with Shakeel.
The dismissal brought back Azhar, who had retired hurt the previous evening after copping a nasty blow to the finger from Robinson. It was Robinson who struck again when Shakeel fell after a fine half-century on debut. England had set attacking fields throughout and Robinson snared Shakeel with a fuller ball outside off which hooped to short cover where Keaton Jennings, substitute fielder for the injured Liam Livingstone, took a mid-air stunner leaping to his right.
England thought Robinson had another when he struck Salman on the pad lunging forward, but umpire Joel Wilson's not-out decision was upheld on review with the ball going down the leg side.
If they hoped that was the breakthrough they needed, England were convinced when a return to spin saw Salman given out lbw after being struck in the midriff attempting to slog-sweep Leach. But the batter overturned his dismissal when the DRS revealed the ball was going over the stumps. Compounding their woes, Robinson saw Pope drop a tough chance down the leg side off Azhar, on 36, in the over before tea.
In the end, no chances or half-chances mattered as England's patience and new-found faith in themselves under Stokes and head coach Brendon McCullum won the day.