England 277-7 (C Woakes 84*, J Buttler 75, Y Shah 4-99) and 219 (O Pope 62, J Buttler 38, Y Shah 4-66) beat Pakistan 326 (S Mansood 156, B Azam 69, S Broad 3-54, J Archer 3-59) and 169 (S Broad 3-37) by three wickets.
Chris Woakes stood tall at the close as he and Jos Buttler shared in a magnificent chase that saw England provid a classic first Test against Pakistan with a worthy finale.
England were on the rocks when the pair came together on the fourth afternoon, 117 for five on an Emirates Old Trafford pitch that was starting to play tricks and with their target of 277 a dim and distant prospect.
But the pair reclaimed the upper hand in style, putting on 139 in a brilliantly judged sixth-wicket stand that set up a memorable three-wicket victory.
Woakes has been in sensational form with the ball all summer but his remarkable 84 not out, including 10 fours and the deciding runs, saw him turn match-winner with his highest score in more than two years.
Buttler owed a debt to his team after three costly misses behind the stumps in the first innings and paid with a flourish, making a superb counter-attacking 75 that made good on the selectors’ ongoing faith.
Only once before has a higher fourth-innings score won a Test in Manchester, Michael Vaughan’s side against New Zealand in 2008, and this now joins last year’s ‘miracle of Headingley’ as an unlikely fightback for the ages.
It may not have the Ashes kudos, the nail-bitingly tense finish or the all-important crowd but as an example of cool batsmanship against a pedigree attack, it bears comparison.
The day began at full throttle with Pakistan’s innings wrapped up for 169 in a 16-ball blur that contained 32 runs and two wickets.
Time was no concern when the final innings began, with the best part of six sessions left in the game and with memories still fresh of top-order collapse on day two — 12 for three inside six overs.
A lunch score of 55 for one represented solid progress, Rory Burns the man to go to a fractional lbw decision in Mohammad Abbas' favour, with Dom Sibley going about his business methodically and Joe Root carefully negotiating a much-anticipated first spell from Yasir.
The steady accumulation continued in the afternoon until Sibley broke ranks, swinging hard when Yasir tossed one up to the stumps and squirting to slip. After 114 balls and 36 tough runs it was a soft end.
Having broken the stand at 64, Pakistan went on the charge as England’s middle-order engine room crumbled in taxing conditions. Root gave it away on 42, shaping to steer Naseem Shah to his favourite outlet at third man but fending a rising delivery to Babar Azam.
Ben Stokes found himself in an all-too familiar position but was unable to answer the call this time. It took lavish, unnatural bounce from Yasir to beat him on nine, with a light brush of the glove on the way through to Mohammad Rizwan.
The writing appeared to be on the wall when Shaheen Afridi got one to explode off the pitch at Ollie Pope, leaving him no option but to flinch in shock and loop a catch to gully. With four wickets tumbling for 31 runs, the winning line now seemed distant and the pitch wholly unreliable.
In those circumstances, what Buttler and Woakes produced was incredible. The pair put on exactly 50 in jut 49 balls before tea, egging each other on with a series of increasingly dazzling shots.
Buttler went after Yasir with a pair of classic drives and glorious sweeps on either side of the wicket, while Woakes took the game to Shaheen with four lavish strokes in the arc between cover and point.
The speed of the reversal was dizzying, barely leaving Pakistan time to realise how much damage had been inflicted. The tea break might have broken the spell but a serene on-drive and deft late cut from Woakes suggested otherwise as the target came down to double figures.
Both men reached half-centuries in the 63rd over, Butter marginally quicker in 55 balls but Woakes in real style as he punched Naseem for back-to-back fours through cover.
Pakistan slowed the rate by pushing out the field but the batsmen shifted accordingly, ticking off the century stand in little more than 20 overs then dragging the required runs under 50.
In desperation Pakistan burned their last two reviews in the space of eight balls before a slog-swept six from Buttler brought the line ever closer.
Yasir guaranteed England did not get there without a scare, winning another close call against Buttler and then seeing off Broad too, but Woakes remained. The winning runs came via a thick outside edge but his knock will go down as one of the very highest calibre.