Three of Ajmal's wickets came after the use of the decision review system, including a controversial dismissal of star South African batsman Jacques Kallis. South African captain Graeme Smith and Hashim Amla were both out leg before wicket after being given not out by umpire Steve Davis.
Kallis was given out caught at short leg and immediately called for a review, which showed that the ball had not touched his bat before looping off his pad to the fielder. But he was then given out leg before on the advice of television umpire Billy Bowden, although replays showed the ball was only brushing the outside of his leg stump, in the area known as "umpire's call".
Kallis was clearly shocked and stood at the wicket seeking clarity before reluctantly returning to the pavilion. It was not clear what the conversation between Davis and Bowden had been and on what basis Kallis was given out on what was a marginal call.
Controversy apart, it was a superb display of bowling by Ajmal, who bowled 25 overs unchanged into a stiff south-easterly wind, varying his flight and mixing off-spin with cleverly disguised top spinners and "doosras" which turned away from the right-handed batsmen. It was a productive day for Ajmal, who helped fellow tailender Tanvir Ahmed put on 64 for the ninth wicket to take Pakistan comfortably past the 300 mark. Their eventual total seemed unlikely when Vernon Philander took three wickets in his first three overs to reduce the tourists to 268 for eight. Ajmal came on to bowl after 11 overs had been bowled in South Africa's innings and struck with his ninth delivery, Smith missed a sweep and Pakistan successfully sought a review.
Two overs later Ajmal had Alviro Petersen smartly caught at short leg by Azhar Ali, who dived to his right to hold a sharp chance. At tea, Ajmal had taken two for 20. Amla went back on his stumps and was also given out on review before Kallis was dismissed. He was followed by Faf du Plessis, caught at slip off a "doosra" for South Africa's highest score of 28. AB de Villiers and Dean Elgar survived until the close.
Pakistan batted until lunch after resuming at 253 for five, although Philander's early strikes raised the home side's hopes of wrapping up the innings quickly. Philander, who took 5/59, struck with his first ball of the day when Asad Shafiq was caught at first slip without adding to his overnight score of 111.
Brief scores: Pakistan 338 (Asad Shafiq 111, Younis Khan 111; Vernon Philander 5/59, Morne Morkel 2/59), leads South Africa 139/5 in 60 overs (Faf du Plessis 28, Hashim Amla 25; Saeed Ajmal 5/41)