Electing to bat in the only T20I match of the tour, South Africa were bowled out for 98, a total the hosts surpassed with four overs to spare.
The Proteas, who lost the two-Test series 2-0 and then came back to clinch the one-day internationals 3-2, were two runs less than their previous low score of 100 against Pakistan in 2013.
Gary Stead named new Blackcaps coach
Dinesh Chandimal, who returned from his ban for breaching the spirit of the game, remained unbeaten on 36 to guide the team home in a tricky chase.
But it was Sandakan's bowling figures of 3-19 with his left-arm wrist spin that set up the win. He was ably supported by fellow spinners Dhananjaya de Silva and Akila Dananjaya who took two wickets each.
Wicketkeeper-batsman Quinton de Kock top-scored with 20 but the rest of the South African batting fell flat in 16.4 overs.
Sri Lankan batsmen also made heavy weather of their 99-run target as the South African bowlers led by paceman Kagiso Rabada made the hosts work hard for their win.
Rabada, fellow paceman Junior Dala and spinner Tabraiz Shamsi took two wickets each.
Kohli eyes improvement after Lord's debacle
From a comfortable 59-2 the hosts slipped to 88-7, but Chandimal kept his calm during his 33-ball stay that laced with 3 fours and 1 six.
Chandimal, 28, was banned for two Tests and four ODIs after refusing to take the field against West Indies following ball-tampering allegations in June.
Sri Lanka now host England for a full series in October-November while South Africa travel to Australia for three ODI matches and one T20I during the same period.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ