Manish Pandey's maiden century for India secured a dramatic six-wicket victory at the SCG which denied Australia a one-day international series whitewash despite tons from David Warner and Mitchell Marsh.
An almighty collapse prevented the tourists from winning their first game of the series in Canberra on Wednesday, but they were not to be denied a consolation triumph three days later.
Warner smashed a brilliant 122 from only 113 balls and Marsh (102 not out off 84) silenced his critics by making his first international hundred, but Australia's total of 330-7 was not enough.
Rohit Sharma (99) and Shikhar Dhawan (78) put on 123 for the first wicket and Pandey (104 not out from 81) - in for the injured Ajinkya Rahane - held his nerve in the final over to get India home in only his fourth ODI and ensure the series finished 4-1.
The total of 3159 runs scored set a new record for a bilateral ODI series of five or fewer matches.
Ishant Sharma (2-60) trapped the dangerous Aaron Finch (6) leg before in the first over and debutant Jasprit Bumrah (2-40) claimed the scalp of captain Steve Smith (28) to reduce Australia to 64-2 after MS Dhoni won the toss and opted to bowl first.
George Bailey (6) also fell cheaply and Australia were 117-4 when Shaun Marsh (7) was run out, but Warner shifted through the gears and the decision to move Mitchell Marsh down to number six paid off as the pair put on 118 in 17 overs.
Warner clubbed Gurkeerat Singh for a huge six in the 24th over as he brought up his century in as many balls before Ishant ended his thrilling knock - which included three sixes and nine fours.
Much has been made of Mitchell Marsh's lack of runs, but the all-rounder was able to celebrate a first international ton in the final over, while Matthew Wade made a brisk 36.
Rohit and Dhawan got India off to a flying start, with the latter in great touch as he blasted three sixes and scored at a rapid rate before falling to John Hastings (3-61).
Hastings then got rid of Virat Kohli (8), who hit the Spidercam with his first delivery, to reduce the tourists to 134-2, but Rohit played the anchor role with great effect as he closed in on three figures.
The opener was dropped by Shaun Marsh in the deep on 92, but fell agonisingly short of another hundred when he edged Hastings behind.
India needed 13 from the final over from Mitchell Marsh and Dhoni (34), dropped by Nathan Lyon on seven, smashed a six before being caught the following ball, but the composed Pandey reached his first century and then finishied off the job with two balls to spare.