Cape Town: Former captain Quinton de Kock hit a sparkling century to set up a four-run win for South Africa in the third one-day international against India at Newlands in Cape Town on Sunday.
South Africa completed a 3-0 clean sweep in the series but not before what captain Temba Bavuma described as a "crazy" finish.
The hosts seemed set for a comfortable win when India lost their seventh wicket when they were still 65 runs short of their 288-run target.
Deepak Chahar, playing in his first match of the tour, thrashed 54 off 34 balls and took India to within 10 runs of victory with three overs remaining.
But Chahar sliced a catch to cover off Lungi Ngidi and the last three wickets fell for five runs.
De Kock, who handed over the white ball captaincy last March to Temba Bavuma, made 124 off 130 balls and made batting look easy on a pitch which offered some help to both seam and spin bowlers.
De Kock, who was named player of the match and player of the series, said of the pitch, "It wasn't flat at all. It was the kind of wicket where you were never really in."
India were on track for victory while Shikhar Dhawan (61) and Virat Kohli (65) were together during a second-wicket stand of 98
But Dhawan and Risabh Pant fell to Andile Phelukwayo in the same over and the odds swung firmly towards South Africa when Kohli was caught at cover off left-arm spinner Keshav Maharaj.
Suryakumar Yadav hit 39 off 32 balls but his dismissal, which was quickly followed by that of namesake Jayant Yadav, seemed to have settled the match.
Chahar, though, went for his shots, hitting two successive sixes off Dwaine Pretorius in the 44th over to reduce the target to 41 off 36 balls.
Chahar continued to attack the bowling and Ngidi and Sisanda Magala both bowled wides and Magala was no-balled as the South Africans lost their composure.
"We tried a couple of things that didn't come off," said Bavuma.
But Chahar played one shot too many and India lost their last two wickets quickly.
"We gave ourselves a real chance," said Indian captain KL Rahul.
"It is quite obvious where we have gone wrong. At times our shot selection has been really poor. We played well in patches but didn't keep the pressure on the opposition for long periods."