The first Test between Pakistan and England in Rawalpindi took a dramatic turn as a bold declaration from the visitors and eventful final hour set up a thrilling finish.
Having taken a 78-run lead on a surface that looked tailor-made for batting, England declared their second innings on 264-7 to set Pakistan an enticing victory target of 343 with four sessions to go.
On a pitch where seven batsmen smashed hundreds, England's fast bowlers bent their backs and diligently pursued a short-ball strategy to dent Pakistan's top order.
The home side finished the penultimate day on 80-2, still 263 behind their target, with No 3 batsman Azhar Ali unlikely to bat again after retiring hurt with a damaged finger.
Opener Imam-ul-Haq (43) and debutant Saud Shakeel (24) resisted England's bowlers before bad light stopped play.
The day took an interesting turn when England batsman Joe Root surprised all by batting left-handed against leg spinner Zahid Mahmood for a couple of deliveries before returning to his usual stance. From there, it was action throughout.
Earlier, Pakistan were bowled out for 579 in reply to England's first-innings 657.
England then continued the push for victory with yet another electrifying display with the bat from the top order in the second session. Root smashed 73 of 69 balls and Harry Brook followed his belligerent century in the first innings with 87 off 65 deliveries before getting bowled by fast bowler Naseem Shah (2-66).
England added 218 runs in the second session to finish the innings with a run rate of 7.4 an over.
Then with the ball, England brought the game alive. Stokes combined with Ollie Robinson to rattle Pakistan's top order.
Robinson removed Abdullah Shafique for six and, two balls later, forced Azhar to retire hurt. Stokes sent groans across the stadium in the next over with a bouncer, which Pakistan captain Babar Azam, who made four, could only edge through to wicketkeeper Pope.