The Black Caps need six wickets on the final day of the second test against Sri Lanka to capture their first test victory in 10 months after a captivating day four in which 17 wickets fell.
New Zealand set the hosts 363 to win the match, which would be the highest ever chase at Colombo, an unlikely prospect with Sri Lanka needing just a draw to win the series. At stumps the hosts were 47-4 needing a further 316 runs to chase down victory.
Skipper Ross Taylor capped off his first innings century with another crucial knock of 74 as the Black Caps declared at 194-9 in the second innings after they knocked off the Sri Lankan first innings within eight overs at the start of the day.
Taylor once again played a captain's innings putting on 97 for the sixth wicket with debutant Todd Astle (35) after New Zealand were 75-5 in their second innings with three wickets falling in four balls.
Tim Southee (2-19) and Doug Bracewell (2-5) put the Black Caps in a position to square the series tomorrow and win their first test in Sri Lanka since 1998.
Southee gave New Zealand the perfect start in Sri Lanka's second innings by trapping Tharanga Paranavitana LBW with the first ball of the innings. He then picked up his second when Tillakaratne Dilshan edged behind for 14.
Bracewell then took his first wicket of the series and it was a well-timed, bowling the world's second ranked test batsman Kumar Sangakkara for 16 and backed that up with the dismissal of Sri Lankan captain Mahela Jayawardene.
17 wickets fell on day four, most came in bunches, with the Black Caps wrapping up the Sri Lankan first innings early into the opening session.
Maybe all the Black Caps needed was a bit of luck to end their form slump and it came earlier in the day when the new ball had to be changed for the fifth time in the match after losing its shape yet again on day four.
With a new swinging ball in hand Southee completed his third career five-wicket bag and Trent Boult picked up three wickets in the session as the Black Caps needed just eight overs to wrap up the Sri Lankan innings and hold a 168 run lead. Southee finished with 5-62 and Boult 4-42, taking 3-8 from his four overs in the opening session.
The bad batch of balls continued in New Zealand's second innings with two replacements needed inside seven overs and led to the downfall of Guptill.
Guptill and Brendon McCullum got through to 32 before Shaminda Eranga had Guptill edging to Dilshan at gully for 11. It ended a forgettable time at the crease for the New Zealand opener in Sri Lanka having failed to pass 14 in all four test innings.
McCullum reached 35 from 43 balls and looked in ominous form with seven boundaries before he out stretched for a Herath delivery and was stumped by Prasanna Jayawardene.
With first innings centurians Kane Williamson and Ross Taylor at the crease the Black Caps were in good stead to build a commanding lead before the wickets started to fall. And fast, with three departing in four balls.
Williamson (18) produced a tentative drive to a wide delivery from Nuwan Kulasekara which sent an edge to first slip. Kulasekara then captured Daniel Flynn with a first ball duck LBW and New Zealand were 74-4. Kruger van Wyk joined Flynn with a golden duck, caught at leg slip to Herath to complete a four-ball pair for the match.
At 75-5, skipper Taylor and newcomer Astle steadied the ship, adding 97 for the sixth wicket, and ensured New Zealand remained in control of the match.
After a defiant 100-ball knock Astle was eventually dismissed in unlucky circumstances for 35 when he swept onto the ankle of short-leg before the ball ballooned up in the air for Dilshan at midwicket. After earlier losing three wickets in four balls the Black Caps then lost their next three in eight balls wit Bracewell (1) handing Herath his 20th wicket of the series caught down the ground before Southee ran out Taylor.
Jeetan Patel was stumped for a duck, the third of the innings, trying to lift the scoring before the declaration which eventually came following a Southee six getting New Zealand to 194 for nine.