Hafeez fell to a low catch in the slips by Tim Southee off paceman Trent Boult as Pakistan were 0-1 at lunch after BJ Watling's fighting, unbeaten 77 took New Zealand to 274 all out in their first innings.
Fellow opener Imam-ul-Haq was unbeaten on nought as Pakistan trailed by 274 runs with nine wickets intact as both teams fight for a series-clinching win.
The three-match series is tied at 1-1.
It was Watling who carried New Zealand's overnight total from 229-7 and added an invaluable 45 runs over the last three wickets to frustrate Pakistan.
During his five-and-a-half-hour knock Watling, when on 66, passed 3,000 runs in his 56th Test.
Watling and debutant Will Somerville kept Pakistan's bowlers at bay, adding 45 runs for the eighth wicket before off-spinner Bilal Asif took all three final wickets to finish with 5-65, his second five-for in five Tests.
Watling, playing his 56th Test, reached his 16th Test half-century with a boundary off medium pacer Hasan Ali after facing 199 balls.
In all he batted for five hours and 32 minutes, hitting four boundaries. Asif bowled Somerville without any addition to his overnight score of 12, then had Ajaz Patel caught for six before bowling Boult for one.
Leg-spinner Yasir Shah, in his 33rd Test, failed to add to his three wickets on Monday, leaving him two short of becoming the fastest man to reach 200 Test scalps.
The current record has stood for 82 years after Australia's Clarrie Grimmett reached 200 wickets in 36 Tests in 1936.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)