A confident batting display, with just one half-chance offered to the home side, saw Hafeez anchor a high-scoring game as Pakistan made 299 for four off their 50 overs.
In reply, Zimbabwe fell well short but only after a promising partnership between captain Brendan Taylor and Malcolm Waller was broken with another 100 runs required off the last 11 overs.
The three-match series is now tied a 1-1 after Zimbabwe recorded their first win over Pakistan in 15 years on Tuesday.
The third and deciding match is also at the Harare Sports Club on Saturday.
Hafeez reached his second highest score in one-day cricket off 205 balls and was he ably supported by Umar Amin (59) and a late cameo from the swashbuckling Shahid Afridi.
Pakistan upped their scoring rate considerably towards the end of the innings as Afridi smashed an unbeaten 39 off 35 balls, setting Zimbabwe the target of a run per ball to win.
"We wanted to win comprehensively but we were looking at about 260, we never thought we'd get up near 300. The wicket was a little green at the start but the conditions improved," Hafeez said after accepting the man of the match award.
A fiery opening spell from Mohammad Irfan stalled Zimbabwe's openers initially but Hamilton Masakadza (24) cut loose before a length ball from Junaid Khan bowled him.
Taylor's application offered Zimbabwe hope of chasing down the formidable target as he combined first with Sean Williams (37) and then Waller.
But as Zimbabwe reached 200 in the 39th over, Taylor, well set on 79, top-edged a high ball that the seven-foot Irfan plucked out of the air with one hand, sparking a lower-order collapse.
Waller went for 40 two balls later off an inside edge as he tried to run the ball down to third man and the last four wickets followed with the addition of just nine more runs.
"Chasing 300 against an attack like Pakistan was always going to be difficult but we were in with a chance before we let it go. It seemed to just run away from us," Taylor said.