(CNN) -- All three results remain possible as New Zealand and Pakistan head into the final day of their three-Test series.
The hosts appeared to have taken control of the decider in Napier when they claimed a 248-run first-innings lead.
But a patient display saw Pakistan's top four all make half-centuries as they reached 347 for four by the close of a rain-hit day four -- 99 runs ahead with six wickets intact.
Openers Imran Farhat -- who carried his bat for 117 not out in his side's first innings of 223 -- and Salman Butt resumed on an unbroken stand of 128.
But Kiwi captain Daniel Vettori sprung a surprise by opening the day with the part-time spin of top-order batsman Martin Guptill and was rewarded with two quick wickets.
Butt scooped the third ball of the day back to the bowler without adding to his overnight 66, while Farhat contributed just six after the resumption before offering Guptill his second return catch.
His exit, for 61, left Guptill with figures of two for 16 and Pakistan needing to rebuild from 146 for two.
That they did as Faisal Iqbal and captain Mohammad Yousuf dug in. Yousuf in particular made a solid start until seven runs from an Iain O'Brien over doubled his score and gave him some momentum.
He had a let-off when Guptill missed a run-out chance, but hit four fours and a six en route to a 117-ball fifty.
Iqbal, meanwhile, made serene progress to 48, but a loose shot off O'Brien flew off the edge to Ross Taylor at slip, only for the Kiwi batsman -- owner of one of the safest pairs of hands in the team -- to drop a simple chance.
Iqbal capitalized four balls later with a boundary to bring up his fifty and take his team into the lead.
Three more boundaries followed in O'Brien's next two overs -- but Chris Martin snared Iqbal for 67 shortly before the interval when he again swung without footwork and Taylor this time held on to end a stand of 128.
Yousuf was unbeaten on 75 at the interval but added only a further 14 before fending a short ball from O'Brien to keeper Brendon McCullum and walking without waiting for the umpire's decision.
Umar Akmal then took center stage, opening his account with an extravagant six off Daryl Tuffey and moving to 24 from as many deliveries with two boundaries in one Vettori over.
He then settled down, going scoreless for 19 balls and hitting only two further boundaries as he closed on 48 not out from 84.
Misbah-ul-Haq was unbeaten on four at the other end, with a good start from the duo vital on the final day if Pakistan are to first avoid defeat and then think about wrapping up the series.