Quinton de Kock scored a superb century as South Africa completed a clean sweep of their three-match one-day international series against India with a tense four-run victory at Newlands on Sunday.
India chose to field and restricted South Africa to 287 all out one ball shy of the 50 overs, but the visitors narrowly failed in their chase as they managed 283 with four balls left in the innings.
Deepak Chahar scored a fine 54 from 33 balls to get India close, but they lost their last three wickets for the addition of five runs as the home side bundled out the lower order.
De Kock's 17th ODI century boosted South Africa's total, his 124 coming from 130 balls and he added 134 for the fourth wicket with Rassie van der Dussen who made a solid 52 from 59 balls.
David Miller weighed in with 39 at the end of the innings, but South Africa may have felt they were 30 runs short having been 214 for three in the 36th over. Prasidh Krishna was the pick of the visiting attack with 3-59.
India were on course in their chase when they reached 116 for one in the 23rd over, but two quick wickets proved a massive setback.
Shikhar Dhawan (61) skied a pull shot to wicketkeeper De Kock off seamer Andile Phehlukwayo (2-38), and off his first ball the dangerous Rishabh Pant tried to launch the same bowler for six but was caught at deep cover.
It was poor shot selection from Pant, not for the first time on the tour.
When former captain Virat Kohli (65) departed, only the lively 54 from Chahar got India within touching distance.
Seamers Lungi Ngidi (3-58) and Phehlukwayo (3-40) again impressed for the hosts.
South Africa won the three-match test series 2-1.