Dean Elgar hit a century as South Africa reached 268-5 at the close of play on day one of the first Test against Sri Lanka at Galle.
The tourists had reached 195 for the loss of only one wicket but the dismissal of Elgar for 103 gave some much-needed impetus to Sri Lanka, who went on to finish the day strongly.
Dilruwan Perera and Suranga Lakmal took two wickets each, the latter claiming the scalp of Elgar and the former managing to remove Faf du Plessis for 80.
Hashim Amla, playing his first innings since being named as the Proteas’ new Test captain, could only manage 11 before being ousted by Rangana Herath.
Amla had earlier won the toss and after his side took to the crease, Alviro Petersen (34) and Elgar produced a first-wicket stand of 70 that was concluded when the former was trapped lbw by Perera.
Du Plessis came in and kept things ticking along after surviving a review, while Elgar sealed what his second Test hundred by hitting Perera for six.
South Africa were in a dominant position at tea but shortly after the interval Elgar was sent back to the pavilion when his edge off Lakmal was caught behind by Dinesh Chandimal.
Amla lasted 36 balls before he was caught by Perera at mid-off from a Herath delivery, leaving South Africa on 220-3.
Du Plessis - having struck five fours and a six - was then removed, caught smartly by Kaushal Silva at short leg off Perera.
The final wicket of the day came in the penultimate over when AB de Villiers, who had just seen an on-field decision to dismiss him overturned on review, was bowled for 21 by Lakmal.
Quinton de Kock and Dale Steyn were the men in the middle at stumps, on 17 and nought respectively.