Hafeez, leading Pakistan in the absence of injured captain Azhar Ali, carried Pakistan to 221-4 with a 72-run knock to level the series 1-1.
Melbourne: Stand-in captain Mohammad Hafeez led Pakistan to its first victory on the tour of Australia with a six-wicket win in the second one-day international of the five-match series on Sunday.
Hafeez, leading Pakistan in the absence of injured captain Azhar Ali, carried Pakistan to 221-4 off 47.4 overs with a 72-run knock to level the series 1-1.
Left-arm fast bowlers Mohammad Amir took 3-47 and Junaid Khan made a comeback to international cricket with an opening burst of two wickets to dismiss Australia for 220 in 48.2 overs.
Hafeez was standing in as captain after Azhar injured his right hamstring in Pakistan's 92-run defeat at Brisbane and was unavailable for the Melbourne match.
"The boys did a great job for us, especially Amir, Imad and Junaid as the ball was not coming onto the bat," Hafeez said. "This is the way to move forward and we've got everything to win the series. The next three games are open for us and hopefully we can do the job for Pakistan."
Shoaib Malik - one of the three replacements Pakistan made from the first ODI - shared 53-run stand with Asad Shafiq (13) to make sure Hafeez's effort wasn't in vain and Pakistan recorded its first ODI win against Australia at the Melbourne Cricket Ground since 1985.
Hafeez was also a late inclusion as the 16th player in the Pakistan's ODI squad after he cleared his illegal bowling action and was primarily included in the squad for his offspin bowling.
Australia had its chances but couldn't grasp the two opportunities provided by Hafeez.
Captain Steve Smith missed a two-handed sitter of Hafeez in Mitchel Starc's first over before Pakistan could have begun its run-chase as Sharjeel Khan (29) then grafted a 68-run opening stand with Hafeez.
Hafeez was again missed at short cover by a leaping Pat Cummins just after he flicked Starc to the square leg boundary and raised his half century off 81 balls.
"We went a little bit too hard with the bat ... ordinary with the bat in these first two games, aside from Wade's hundred (at Brisbane)," Smith said. "We needed to build partnerships, (but) we haven't been able to play naturally against them and we were outplayed by Pakistan."
Babar Azam (34) also added a further 72 runs with Hafeez to ease the run-chase before both were caught by Josh Hazlewood in successive overs in the space of two runs. Azam sliced a catch off Starc and Faulkner had Hafeez caught at mid-on.
Earlier, Amir took three wickets as Pakistan capitalized on its early breakthroughs to dismiss Australia with 10 balls to go in the innings.
Smith tried to marshal the innings, grafting for 60 runs from 101 balls to top the scoring before he dragged a ball from Imad Wasim onto his stumps.
Malik bowled Matthew Wade for 35 and the lower-order failed to bat out the allotted 50 overs, with Junaid running out Starc (3) and Amir following up his early dismissal of Mitch Marsh (0) to take the last two wickets with well-targeted short balls.
Pakistan had Australia in trouble at 78-5 in the series-opener but Wade led the rally with his maiden ODI century.
A Pakistan lineup containing three changes had Australia struggling again in Melbourne at 86-4, with Junaid removing openers David Warner (16) and Usman Khawaja (17). But this time Pakistan's bowling attack maintained the pressure through the innings after Smith won the toss and elected to bat.
The Australians swept the test series 3-0 and were convincing winners in the first of five ODIs before Pakistan finally broke the losing streak.