SA batting first scored 304 runs, Hashim Amla (109) anchored the innings with a hard-fought hundred and had a 151-run partnership with AB de Villiers (75).
The pair set their team up for a final assault, which David Miller provided. Miller led the late charge and South Africa scored 53 runs in the final five overs to post their highest total in Sri Lanka, leaving with hosts with the challenge of scoring the highest second-innings total at the Premadasa.
Ajantha Mendis was at the pick of Sri Lankan bowlers figuring 10-0-61-3.
Sri Lanka started off well giving 50-runs stand, Kusal Perera enjoyed the pace of Dale Steyn and cashed in on a poor line from Vernon Philander to take Sri Lanka past 50 inside eight overs.
Perera got out of Vernon Philander after scoring 34 off 38. Kumara Sangakkara scored 88 off 84 balls but can’t help Sri Lanka to get rid of defeat.
Among South African bowlers Imran Tahir dismissed 3 batsmen while Ryan McLaren, Morne Morkel and Dale Steyn took 2 wickets each.
The second ODI of 3-matches series will be played at Pallekele International Cricket Stadium on July 9 (Wednesday).