Johannesburg: South Africa survived a nail-biting finish to edge out India by five wickets in a rain-curtailed fourth One-Day International (ODI) in Johannesburg on Saturday.
India, who had won the first three ODIs, now have a 3-1 lead in the six-match series.
Electing to bat first, India rode on opener Shikhar Dhawan's 13th ODI century to post 289/7 in their 50 overs.
Dhawan scored 109 runs off 105 balls, and shared a 158-run stand with skipper Virat Kohli who scored 75.
The match was interrupted by rain and inclement weather on more than one occasion which saw the target being reduced to 202 runs off 28 overs for South Africa.
The Indian bowlers dominated South African batsmen in the initial stages.
With their top four batsmen back in the pavilion by the 17th over with just 102 runs on the board, the Proteas seemed to have lost their way and headed for certain defeat.
When David Miller was bowled while trying to hit an incoming delivery from leg-spinner Yuzvendra Chahal, the visitors must have thought that the match was as good as in the bag.
But miraculously for South Africa, television replays revealed that the delivery was a no-ball and Miller was back in the middle. That turned out to be the turning point as the match quickly turned on its head.
Miller celebrated by smashing pacer Hardik Pandya for three consecutive boundaries in the next over and the momentum abruptly turned in the hosts' favour.
Chahal did manage to dismiss Miller eventually, trapping him leg before.
But Miller, who scored 39 runs off 28 balls with four boundaries and two sixes, had turned the momentum decisively South Africa's way.
Heinrich Klaasen continued the good work, plundering an unbeaten 43 off 27 deliveries with the help of five boundaries and a six.
Andile Phehlukwayo was also on fire at the other end, smashing three sixes his way to a whirlwind 23 off just five balls as the hosts celebrated a well deserved victory.
Chinaman Kuldeep Yadav was the most successful among the Indian bowlers with figures of 2/51 while fast bowler Jasprit Bumrah, Pandya and Chahal got a wicket each.
Earlier, Dhawan shared a 158-run second-wicket stand with Kohli after opener Rohit Sharma was dismissed early on.
India were cruising at 197/2 in 34 overs when play was interrupted for nearly an hour due to lightning. After play resumed, India lost the plot and lost wickets regularly to what looked an under-par total.
Before the interruption, however, Dhawan and Kohli, dominated the home bowlers and steered India to a position of strength.
Kohli stamped his authority as he continued to punish the South African bowlers. For someone coming into the match with scores of 112, 46 not out, 160 not out, batting looked easy. He registered his 46th ODI fifty.
South Africa, playing without any spinners, looked out of ideas to stop the two with no variety in their bowling. Part-time Jean-Paul Duminy delivered four overs of spin but, expectedly, didn't look like taking a wicket.
The stand was broken when Kohli hit pacer Chris Morris straight into the hands of David Miller at short cover, with India at 178/2 in 31.1 overs.
India's march was halted by lightening with dark clouds hovering over the New Wanderers Stadium.
When the match resumed, Dhawan was the first to be dismissed, driving Morne Morkel to AB De Villiers at mid-off.
Ajinkya Rahane (8) too perished, with a pull off Lungi Ngidi failing to clear Rabada at deep square leg. With these two wickets, things suddenly looked gloomy for India, who were at 210/4.
The saviour of India was old war-horse, Mahendra Singh Dhoni, who remained not out 42 off 43 deliveries.
At the other end, Ngidi and Rabada accounted for Shreyas Iyer (18) and Hardik Pandya (9) to dent India's hopes of a late surge but Dhoni once again showed why he is so important for the side.
South Africa: 207/5 in 25.3 overs (Heinrich Klaasen 43 not out, David Miller 39; Kuldeep Yadav 2/51) vs India: 289/7 (Shikhar Dhawan 109, Virat Kohli 75, Mahendra Singh Dhoni 42 not out; Lungi Ngidi 2/52, Kagiso Rabada 2/58).