Kane Williamson's unbeaten double century gave New Zealand the edge against Pakistan on day four of the Test series opener, with the visitors declaring on 612-9 in their first innings in Karachi.
The former skipper rode his luck to hand the Black Caps a 174-run lead as they try to force a result in a Test that appeared to be meandering toward a draw and take charge of the two-match series.
Williamson reached 200 with a single off spinner Abrar Ahmed, batting for ten hours and striking 21 boundaries and a six in an innings which saw him overturn two leg-before decisions on 13 and 116.
He also survived two stumpings off spinner Nauman Ali on 15 and 21.
Resuming on 440-6, Williamson and Ish Sodhi defied Pakistan's bowling in the first session as the pair took the total to 595 before their seventh wicket stand was broken.
Sodhi was caught off Ahmed for 65 to better his previous best, also against Pakistan in Abu Dhabi in 2018.
Tim Southee and Neil Wagner fell without scoring as New Zealand lost three wickets in the space of two runs, but last man Ajaz Patel held his ground to help Williamson reach the milestone.
Ahmed finished with 5-205 -- his second five-wicket haul -- while Nauman Ali took 3-185.
New Zealand are playing their first Test series in Pakistan for 20 years.