AB de Villiers claimed his highest first-class score to lead South Africa into a dominant position on the second day of the second Test against Pakistan in Abu Dhabi.
De Villiers resumed on 120 and stood firm, scoring a magnificent unbeaten 263 - a record for a South African against Pakistan - as he shepherded the Proteas' tail into reaching 568 for nine.
Pakistan's stand-out bowler was Kuwait-born debutant Tanvir Ahmed, who took two more wickets for figures of six for 120 - only the second Pakistani to take six wickets in an innings on his maiden appearance.
Mark Boucher (45) made most of the early running but Tanvir struck when South Africa had advanced their overnight 311 to 341, as he produced a jaffa of an inswinger to clean bowl Boucher for his fifth wicket, ending a stand of 73.
Johan Botha never looked entirely comfortable - he was dropped by wicketkeeper Adnan Akmal, an edge which went to the boundary taking South Africa past 350 - and he duly became the second wicket to fall, for 12 just before lunch, as he attempted a wild heave off Abdur Rehman and lost his off stump.
At the other end De Villiers remained serene, going past 150 by whipping Tanvir to the boundary and reaching lunch without alarm.De Villiers put on 59 with Dale Steyn, who unleashed a couple of big shots after the resumption, including one huge six over long-on off the bowling of Rehman, however, the spinner eventually got his revenge as Steyn (27) holed out to Mohammad Hafeez going for a repeat.
Rehman conceded a similar six to Paul Harris, who went for his shots before becoming Tanvir's sixth victim, caught behind, for 19.Number 11 Morne Morkel then clubbed three boundaries in a Tanvir over which went for 17, then De Villiers heaved two sixes off Rehman as South Africa sailed past 500.
Another six off Umar Gul took him past 250 and both batsmen continued to swing the bat as the 10th-wicket partnership reached an unbroken 91.