Aiden Markram hit a solid half-century and Rassie van der Dussen gave him able company to give South Africa hope of an improbable and intriguing win in the second Test in Rawalpindi on Sunday.
Set a daunting 370-run target, South Africa finished the fourth day on 127-1 with Markram on 59 and Dussen unbeaten on 48. The tourists will need another 243 runs to level the series on Monday.
Earlier, Pakistan were helped to 298 all out in their second innings by a scintillating maiden hundred by wicketkeeper-batsman Mohammad Rizwan who finished on 115 not out.
South Africa had lost opener Dean Elgar to fast bowler Shaheen Shah Afridi for 17 at the total of 33, before Markram and Dussen negated Pakistani spinners on a seemingly unresponsive pitch, having added 94 for the unbroken second-wicket stand.
Markram, who did not score off his first 22 balls, changed gears to reach his fifth fifty off 71 balls and has so far hit nine boundaries and two sixes.
Dussen has so far hit eight…