Colombo: Hashim Amla struck his first century as South Africa's Test captain in a lonely battle against Sri Lankan spinners on the third day of the second and final Test on Saturday.
Amla showed characteristic grit in making an unbeaten 119 off 300 balls but he failed to find support from the other batsmen on a deteriorating track at the SSC ground in Colombo.
His century, the first by a South African captain in Sri Lanka, helped his side avoid the embarrassment of follow-on but they still trailed the hosts by 187 runs in first innings. Sri Lanka made 421 in their first knock.
At tea, South Africa were 234-7 with Dale Steyn (18) being the other not out batsman.
Off-spinner Dilruwan Perera led the spin charge, taking 4-58 while left-armer Rangana Herath chipped in with 2-48.
South Africa lost Jean-Paul Duminy and Vernon Philander to spin in the second session that saw them put on 71 runs at less than three runs an over.
Duminy (three) fiddled around for more than an hour before he was stumped by Niroshan Dickwella off Herath while Philander was bowled by Perera.
Amla, dropped on 93 at short cover by Kaushal Silva, completed his 22nd Test hundred with a single off Herath, a fitting reward for his lonely toil on the crease.
The bearded batting wizard is leading the side for the first time in this two-Test series after being named skipper last month following the retirement of Graeme Smith.
The first session saw Herath get rid of AB de Villiers (37) and Quinton de Kock for a duck in the space of three balls after South Africa had resumed at their overnight 98-3.
Amla and De Villiers started off positively and saw off the first hour without harm.
Amla broke the shackles with two consecutive fours off unorthodox spinner Ajantha Mendis and De Villiers followed suit, hitting paceman Suranga Lakmal (1-53) for three boundaries in the same over.
De Villiers had a scare on 30 when he gloved Lakmal to the wicketkeeper but TV replays showed the ball had bounced just inches short of Dickwella.
But just when the partnership was building up between Amla and De Villiers, Perera's double-strike reduced South Africa to 150-5.
He first had De Villiers trapped plumb in front off the fourth ball and then knocked the off-stump of De Kock off the last ball of the over.