Pakistan 339 (Misbah 114, Shafiq 73, Woakes 6-70) and 215 (Shafiq 49, Sarfraz 45, Woakes 5-32) beat England 272 (Cook 81, Yasir 6-72) and 207 (Bairstow 48, Yasir 4-69, Rahat 3-47) by 75 runs
Scorecard and ball-by-ball details
Pakistan took a 1-0 lead in the series after beating England by 75 runs at Lord's. That is the simple version but there were multitudes contained within as Misbah-ul-Haq's irrepressible side took the ten wickets they required for victory on the fourth day, four of them going to the talismanic Yasir Shah on the way to match figures of 10 for 141 in his first Test match outside of Asia.
Set 283 to win - a target only one side had previously achieved on the ground - after dismissing Pakistan inside the first ten minutes of the morning session, England's batsmen struggled to build partnerships. Only when Jonny Bairstow and Chris Woakes were putting together a stand of 56 over 31.4 gruelling overs did Misbah have to seriously ponder where a wicket was coming from.
The breakthrough came from Yasir, although there was little sleight of hand about a long hop that Bairstow simply missed attempting to swat through the leg side. His distraught reaction, head bowed over his bat as the Pakistan players celebrated around him, provided an illustration of England's disappointment at losing a match in which they were always slightly behind but refused to abandon as beyond their powers of recovery.
Yasir's tenth wicket practically sparked a playground bundle as Woakes was taken at slip trying to hit out with the No. 10, Steven Finn, for company and 79 still required. Mohammad Amir rattled Jake Ball's stumps an over later to put the final seal on an emotional comeback six years after his previous Test appearance.
This was a gripping encounter, fought in excellent spirit and holding the attention of a packed crowd throughout. A sizeable contingent of Pakistan supporters cheered every wicket as their side pushed for a first Test triumph at Lord's since Waqar Younis and Mushtaq Ahmed's exploits in 1996. When the Pakistan team lined up afterwards to do a series of celebratory push-ups in front of the pavilion - a salute to the military fitness camp undergone by the players before the tour - the whole ground was in raptures.
England may have been primed to the threat posed by Yasir and Amir but it was Rahat Ali who gave Pakistan the early advantage. England lost their top three in little more than an hour of batting and although the rejigged middle order that had been considered a weakness resisted admirably there was too much left for them to do against a constantly probing attack.
Yet while Bairstow remained in the company of Woakes - a man with nine first-class centuries, not to mention 11 wickets in the match - England could imagine that the improbable was still possible. With the bowling tight and scoring opportunities scarce, the seventh-wicket pair resolved to soak up the pressure and fight for every inch.
Nothing seemed to be happening in the middle, yet at the same time, everything was happening. Wahab Riaz threw himself into a five-over spell after tea that yielded 0 for 8 but saw the ball repeatedly swerve late past the outside edge. Both batsmen edged short of catchers in the cordon - Woakes a matter of millimetres in front of Asad Shafiq at third slip - and Wahab ended up lying in the dust as he strained for a breakthrough. He was also warned twice by the umpires for running on the pitch.
At the other end, rewards were not as readily forthcoming for Yasir as had been expected after his first-innings six-for. There was turn - as Gary Ballance discovered when a delivery beat his front pad and attempted flick to end his dogged 43 - but the pitch was placid enough for Woakes and Bairstow to survive as long as they eschewed risk. When Yasir won an lbw decision from Joel Wilson against Woakes, the batsman confidently reviewed in the knowledge that his bat had intervened first.
England had initially recovered through a 49-run partnership between Ballance and James Vince, who made his best Test score before being dismissed by Wahab, flinging his hands at a drive shortly after lunch. Wahab had begun to make the ball reverse away down the slope and a thick edge flew to Younis Khan at second slip, who this time held on to the catch at the second attempt, having unsuccessfully juggled a much tougher chance with Vince on 9.
Ballance, in the second innings of his comeback Test, seemed to grow in confidence, totting up runs with nudges and nurdles. He was vulnerable to Wahab's probing outside off stump but generally played the ball softly and late, other than when slashing a four over the slips. He and Bairstow added another 39 runs in 13 overs of careful batting when Yasir, having changed to bowling from the Nursery End, struck for the first time.
The man identified as Pakistan's likeliest match-winner had to wait until his 13th over but, for aficionados of legspin, it was undoubtedly worth it. Ballance had just pulled a sharply turning delivery through square leg for his sixth boundary; the next ball was a little fuller, spun a little harder down the slope and darted like a swallow past Ballance's attempted flick to hit leg stump. If the shot was questionable, the overall effect was reminiscent Shane Warne's dismissal of Andrew Strauss at Edgbaston in 2005.
Moeen Ali did not last long, waltzing out of his ground and aiming a heave across the line at Yasir, only for the ball to spin between bat and pad to hit the top of middle. At 139 for 6, England were still less than halfway to their target; Pakistan were more than halfway to theirs.
After the third day's play, Pakistan's coach Mickey Arthur was hoping his side could "sneak another 19-20" more runs. They managed just a single from Amir as England took the last two wickets in 13 balls, though that was enough to push the requirement up above the 282 achieved by Michael Vaughan's side against New Zealand in 2004. Stuart Broad picked up both, Yasir and Amir caught behind, to become the third England bowler to pass 350 Test wickets.
Adrenaline coursed through initial stages of England's assault. Cook chopped the opening delivery for four through point as England raced to 19 for 0 from three overs before hitting their first speed bump: Rahat found his line and the tiniest contact with Cook's outside edge, a kiss goodbye for the England captain who turned away ruefully as Kumar Dharmasena's finger went up.
Rahat bagged and tagged the next two as well. Alex Hales attempted to force a cut, a thick top edge flying quickly to be well held by Mohammad Hafeez at first slip; then a misbegotten pull from Joe Root sent a top edge out to the grateful Yasir, jogging to his right to take the catch some 20 yards in from the boundary at deep square leg. It was just one of a multitude of joyous individual and collective moments for Pakistan on a ground where they experienced such pain when the spot-fixing scandal erupted six years ago. They have fresh memories now.
Alan Gardner is an assistant editor at ESPNcricinfo. @alanroderick