South Africa will have to dig deep if they are to avoid defeat in the first Test after being reduced to 72 for four wickets in their second innings, still trailing Pakistan by 121 runs, in Abu Dhabi on Wednesday.
With the wicket taking turn and Pakistan's spinners bowling an immaculate line, the world's number one Test team showed signs of rust with both bat and ball in their first five-day match in eight months.
Having bowled the sub-continent side out for 442 just after tea on day three, South Africa reached 38 in their second innings before Alviro Petersen (17) was caught behind off the bowling of Mohammad Irfan to start a collapse that would see the side lose three more top-order batsmen for the addition of just another 34 runs.
Graeme Smith (32) was next to go as he was stumped at the second attempt by wicketkeeper Adnan Akmal to become Saeed Ajmal's 150th victim in Tests.
Jacques Kallis, celebrating his 38th birthday, had a day to forget as he was trapped plumb lbw by Junaid Khan without scoring.
Pakistan completed their excellent day when Hashim Amla (10) was caught by Akmal off the bowling of Zulfiqar Babar to compound the misery for the visitors.
AB de Villiers (11 not out) and nightwatchman Dale Steyn (0 not out) will resume on day four.
Earlier, Misbah-ul-Haq scored his fourth Test century to help Pakistan to a first innings score of 442.
The Pakistan captain bagged his first ton against the Proteas before he was out two balls later for exactly 100, lbw to Steyn.
He was ably supported by Asad Shafiq, who compiled a patient 54 from 104 balls and put on 82 runs for the fifth wicket with his captain before becoming JP Duminy's second wicket of the innings when he clipped the ball to Peterson at mid-wicket.
South Africa then made fairly light work of the tail, Saeed Ajmal struck a brisk 13 before edging a Vernon Philander delivery to wicket-keeper De Villiers, and Zulfiqar Babar was run out for two by Steyn with the last ball before tea.
Steyn picked up the last two wickets as he had Junaid Khan (3) caught by Morne Morkel and then bowled Akmal (32) with an excellent yorker.
Khurram Manzoor, who reached his maiden Test century on Tuesday, was the only wicket to fall in Wednesday's opening session, caught behind for 146, as he slashed at a rising delivery from Philander and was taken at second slip by a diving Kallis.
The two-match series is being played in the United Arab Emirates due to security concerns in Pakistan.
South Africa first innings 249 all out
Pakistan first innings
Khurram Manzoor c Kallis b Philander 146
Shan Masood lbw b Duminy 75
Azhar Ali c de Villiers b Philander 11
Younus Khan c Petersen b Morkel 1
Misbah-ul-Haq lbw Steyn 100
Asad Shafiq c Petersen b Duminy 54
Adnan Akmal b Steyn 32
Saeed Ajmal c de Villiers b Philander 13
Zulfiqar Babar run out 2
Junaid Khan c Morkel b Steyn 3
Mohammad Irfan not out 0
Extras (lb-4, nb-1) 5
Total (all out, 138.4 overs) 442
Fall of wickets: 1-135, 2-173, 3-178, 4-290, 5-372, 6-394, 7-423, 8-429, 9-437
Bowling: D. Steyn 28.4-5-88-3 (nb-1), V. Philander 26-5-84-3, M. Morkel 23-5-35-1, J. Kallis 13-2-44-0, R. Peterson 27-2-111-0, JP Duminy 19-1-68-2, F. Du Plessis 2-0-8-0.
South Africa second innings
G. Smith st Akmal b Ajmal 32
A. Petersen c Akmal b Irfan 17
H. Amla c Akmal b Babar 10
J. Kallis lbw Khan 0
AB de Villers not out 11
D. Steyn not out 0
Extras (nb-2) 2
Total (for four wickets, 26 overs) 72
Fall of wicket: 1-38, 2-57, 3-58, 4-72
Bowling: M. Irfan 8-0-29-1, J. Khan 6-0-22-1, S. Ajmal 11-4-21-1, Z. Babar 1-1-0-1
Photograph: Gareth Copley/Getty Images