Cape Town - South African bowlers Kagiso Rabada and Tabraiz Shamsi claimed four wickets each as Sri Lanka were bowled out for 193 in the first one-day international on Sunday.
Sri Lanka lasted just 34.3 overs but batsman Kusal Perera hit a gritty 81 to lift the hosts from a precarious 36-5 following their decision to bat first in Dambulla.
Kusal, whose 72-ball stay included seven fours and a six, put on a crucial 92-run sixth-wicket stand with Thisara Perera, who made 49.
Rabada, South Africa's pace spearhead, rattled the Sri Lankan top-order with his first three strikes while Shamsi returned career-best one-day figures of 4-33.
Kusal and Thisara counter-attacked to hit the South African bowlers to all parts of the ground as Sri Lanka reached 100 in the 16th over.
The left-handed batting duo cashed in on the inexperience of rookie pacemen Willem Mulder and Andile Phehlukwayo as they plundered runs.
But the introduction of spin in the 18th over again put Sri Lanka in trouble as Shamsi broke the dangerous partnership by getting Thisara caught behind.
Kusal kept up the good work to get his fourth ODI fifty and got support from Akila Dananjaya with a 38-run partnership.
He finally fell to Shamsi after attempting a reverse sweep to get caught at point.