England lost a flurry of wickets as it chased 277 for victory over Pakistan on day four of the first Test on Saturday, but Jos Buttler and Chris Woakes launched a counter-attack before tea to leave the game thrillingly poised.
The host slumped from 86 for one to 117 for five as some superb bowling gave Pakistan a stranglehold midway through the afternoon, but Buttler and Woakes then put on 50 in 49 balls to take the score to 167 for five.
Pakistan began the day on 137 for eight in its second innings but blazed another 32 runs to be all out for 169, setting England a tough target on a pitch offering pace, bounce and spin.
Mohammad Abbas trapped opener Rory Burns leg before for 10 before England crept to 55 for one at lunch as skipper Joe Root and Dom Sibley dug in to give a solid platform.
Sibley showed great patience in reaching 36 but paid the price for a rash shot when his drive off leg-spinner Yasir Shah was taken by Asad Shafiq at slip.
Root swept to 42 but just when he looked set for a big score he fell to a superbly-directed delivery from teenager Naseem Shah, the ball catching the splice of the bat and being held by Babar Azam at first slip.
It looked even better for Pakistan when Yasir spun one out of the rough to have Ben Stokes caught behind the stumps by Mohammad Rizwan on review, after England's dangerman was initially given not out by the on-field umpire.
Ollie Pope could do nothing about his dismissal as Shaheen Afridi produced an unplayable ball that rose sharply off a length, caught his glove and looped up to Shadab Khan at gully.
England was in a hole, but Buttler and Woakes went into one-day mode and began to pepper the boundaries.