Pakistan batsmen Misbah-ul-Haq and Asad Shafiq held up South Africa's push for victory with a defiant fifth wicket partnership on the third day of the first Test at the Wanderers Stadium on Sunday.
Pakistan were 183 for four at the close after being set to make an improbable 480 to win.
The match seemed headed for an early finish when the first four wickets fell for 82 runs, but Pakistan captain Misbah (44 not out) and the stocky Shafiq (53 not out) defended grimly for more than three hours, adding an unbeaten 101.
South Africa remained in a strong position to take a 1-0 lead in the three-match series, however, with a second new ball due after five overs and only wicketkeeper Sarfraz Ahmed of the remaining batsmen likely to offer resistance.
Brief Scores: SA 253 & 275/3d (de Villiers 103no, Amla 74no) vs Pak 49 & 183/4 (Shafiq 53no).