e total was less than expected but more than enough as Sri Lanka was bowled out for 203 in the 42nd over, with Tahir taking 4-27.
Opener Amla and Faf du Plessis combined for 145 for the second wicket for South Africa, which started slow and finished fast. Amla was involved in five partnerships, and JP Duminy led the team to the end with an unbeaten 38.
The Sri Lankans made a stunning start to their chase, and were going at 8 runs per over when AB de Villiers made a one-handed catch to dismiss Kusal Mendis at 94-2. The Sri Lankans were still steaming when de Villiers finally decided to introduce Tahir in the 18th over.
Tahir was bumped from the world No. 1 bowler's ranking in ODIs this week by teammate and fast bowler Kagiso Rabada. But Tahir would remind of his brilliance in an eventful first over.
Chandimal struck him to extra cover, where de Villiers ran and slid to stop the ball, dropped it picking it up, then threw one-handed underhand and hit the stumps. Chandimal was run out for 12, and three balls later, Tahir trapped Chamara Kapugedera for a first-ball duck at 117-4.
Tahir squeezed the Sri Lanka batting, and when captain Upul Tharanga, on 57, hit Tahir straight to a catch at deep cover at 146-5 in the 26th over, Sri Lanka's fate was certain.
Tahir also finished with a run out, Chris Morris picked up two wickets, and Rabada got one, bowling Lasith Malinga, who was making his first ODI appearance in almost two years.
The final margin of victory was clear, but South Africa had to overcome a slow start to post it's winning total, having been put into bat by Tharanga, who was standing in for injured skipper Angelo Mathews.
South Africa scored just 44 runs in 12 overs when Quinton de Kock was caught behind off Nuwan Pradeep, and the medium-pacer almost had his second wicket shortly after as du Plessis, on 8, skied a hook shot into the leg side. But Malinga lost his footing as he trod on the boundary rope and spilled the ball.
Malinga also failed to take a wicket in his 10 overs but, after all his injuries, he will be relieved to have come through the innings apparently unscathed.
Du Plessis went after the bowlers, scoring his 75 from 70 balls and allowing Amla to calmly reach his 25th ODI century, tied for fifth best all-time.
"All the other players are way better than me," Amla said. "I've just been so fortunate to open the batting and get the opportunity. Virat (Kohli), AB, these guys are far better than I am."
De Villiers knew better: "It was an amazing innings - he did really well to assess the conditions. Faf played exceptionally well coming in in that situation. That partnership gave us a lot of options towards the back end of the innings."
After the match, Tharanga pleaded guilty to a slow over-rate, and was suspended from Sri Lanka's matches against India and Pakistan next week.
On Sunday, India and Pakistan meet at Edgbaston.