The left-handed Imam made a cultured 86 off 101 balls and Hafeez hit an unbeaten 71 off 63 deliveries as Pakistan chased down a target of 267 with five balls to spare.
Amla (108 not out) shared a second-wicket partnership of 155 with debutant Rassie van der Dussen (93) but the pair were unable to dominate against steady bowling on a slow pitch.
The Men in Blue will return home to India triumphant without having lost a Test or limited-overs series -- a first on Australian soil.
The 37-year-old kept his usual cool during an unbeaten 87 off 114 balls as India chased down Australia's 230 with four balls to spare at MCG.
The tourists were mauled in a recent Test series, with none of the three matches going beyond lunch on the fourth day, but have reason to be optimistic in the 50-overs game where fast short-pitched bowling will likely not be a decisive factor.
The extent of the injury is not yet known, but it raises concerns of a stint on the sidelines for the explosive opener alongside disgraced teammate Steve Smith, as the pair face a disrupted return to international cricket.
Gulf Colours Lagaan, Selex post victories in Div A matches
The 52-year-old Indian will join ICC from next month before formally taking over the reins later this year from Richardson, a former South Africa wicketkeeper-batsman.
Former skipper Dhoni, playing in his 334th ODI, cooly guided India across the line with four balls to spare to back up a dazzling century from captain Virat Kohli.
The eight-team domestic competition, in which matches will be 100 balls per side, is central to plans to develop the English game between 2020 and 2024.
Man of the series Duanne Olivier sparked a Pakistan collapse as the tourists were bowled out for 273 at lunch on the fourth day.
De Kock made an imperious 129, equalling his highest Test score, before South Africa were bowled out for 303.
The part-time spinner's action was flagged by match officials, citing concerns about its legality, after the match in Sydney.
Former Australian captain Smith is currently serving a one-year ban from international cricket, Australia's domestic Sheffield Shield and Big Bash leagues.
The South Africans were struggling at 135 for five at the close, an overall lead of 212.