Staring at a series whitewash after four defeats, India rode Pandey's scintillating 104 off 81 balls to chase down a 331-run victory target with two balls to spare.
Centuries from David Warner (122) and Mitchell Marsh (102) helped Australia post 330-7 but Pandey's knock in his only fourth one-dayer clinched the contest for India.
India needed a strong start from their openers to stay on course to chase down such a big total and the visitors got just that from Shikhar Dhawan (78) and Rohit Sharma (99).
Dhawan posted his third successive 50-plus score and Rohit fell agonisingly short of his third century in the series as they raised 123 runs in 18.2 overs.
John Hastings dismissed Dhawan and Virat Kohli (eight) in quick successions to halt India's progress and Rohit left leaving India needing exactly 100 runs from 91 balls to win the contest.
With the required run-rate skyrocketing and skipper Mahendra Singh Dhoni (34) struggling to time the ball at the other end, Pandey's crisp hitting left India needing 13 runs off the last over from Marsh.
Marsh began with a wide and had his next hit out of the ground by Dhoni but the Indian captain fell immediately to inject fresh drama in the contest.
Pandey, however, was unfazed and he hit the next ball for a boundary to first complete his century and then scurried for two for the winning run.
Earlier, Warner struck his fifth ODI century and Mitchell Marsh notched up his first to set up yet another runfest in a series that has provided 3,159 runs.
India's much-maligned bowlers did well to reduce Australia to 117-4 in the 22nd over before Warner and Marsh combined to add 118 runs in 17.3 overs.
Warner had fallen seven runs short of a century in Wednesday's fourth ODI at Canberra but there was no such heartbreak this time as the southpaw brought up his run-a-ball century.
The 27-year-old opener was eventually dismissed for 122, that included thee sixes and nine boundaries, but Marsh carried on to remain not out on 102 off 84 balls.
For India, Jasprit Bumrah made an impressive debut, the right-arm paceman with an unorthodox bowling action sending down 10 tidy overs to claim 2-40 with some tight death bowling.
Pandey was adjudged man-of-the-match, while team mate Rohit won the man-of-the-series award for the 441 runs he amassed in five matches.
Original source: Pandey's ton helps India avoid whitewash