Australia 256 and 77 for 4 (Head 17*, Marsh 27*) need 202 more runs to beat New Zealand 162 and 372 (Ravindra 82, Latham 73, Cummins 4-64, Lyon 3-49)
Matt Henry and Ben Sears tore through Australia's struggling top-order late on a dramatic day three at Hagley Oval, but Mitchell Marsh and Travis Head halted New Zealand's push to leave the second Test on a knife's edge.
Needing 279 runs to clinch the series 2-0, Australia were in disarray at 34 for 4 with Steven Smith, Usman Khawaja, Marnus Labuschagne and Cameron Green falling cheaply. But Marsh and Head produced a steadying 43-run partnership as Australia reached stumps at 77 for 4 and they need a further 202 runs for victory.
Having taken 15 wickets in three innings in the series, Henry loomed as New Zealand's main hope and he had a big caught behind appeal off Khawaja on his first delivery turned down.
But Henry soon had his first breakthrough when he trapped a shuffling Smith lbw for 9. Smith reviewed at the last second, but the decision was upheld and completed his modest series output of 51 runs at 12.75 as the spotlight intensifies on his shift up the order.
Sears continued his eye-catching debut after entering the attack in the ninth over and on his second delivery he had Labuschagne edging to first slip only for Daryl Mitchell to drop a catch low to his right. But it did not cost them a run with Labuschagne two balls later unable to control a lifting delivery as he offered a return catch to Sears.
New Zealand were on a roll when Khawaja edged Henry to Tim Southee, who held a stunning take low to his left in the slips. Australia's collapse was complete when Green chopped on to a pumped-up Sears, who celebrated with gusto.
Coming to the crease after consecutive ducks, Marsh smashed a first-ball boundary and was unperturbed by the situation as he bravely counterattacked. Australia's hopes largely rest with Marsh and Head, who was forced to play defensively before the close.
In what had been a bowler-dominated series, batting was looking easier against the older ball with most of the damage being done with the new ball.
Australia have only chased 279 runs or more 13 times before with the most recent being in Edgbaston last year during the Ashes.
They had earlier restricted New Zealand's lead after Pat Cummins bowled superbly. A 53-run seventh-wicket partnership between Glenn Phillips and Scott Kuggeleijn put New Zealand in position to gain a lead of more than 300 runs. But they fell apart and lost 4 for 23 to be bowled out for 372 shortly after tea.
Cummins was the standout as he finished with 4 for 62, while Nathan Lyon found sharp turn after the interval to rip through the lower order with three wickets.
Wicketkeeper Alex Carey equalled an Australian record with ten dismissals for the match.
After being dismissed for just 162 on day one, New Zealand had fought back ever since to sniff just their second Test victory against Australia in the last three decades.
New Zealand had appeared to be in a position of strength when Mitchell and Rachin Ravindra combined for a 123-run fourth-wicket partnership in the highest stand of the series for either team.
But the match turned shortly after Australia took the second new ball, with Josh Hazlewood nicking off Mitchell for 58 before Ravindra fell for 82 to Cummins' first ball of a new spell when he was caught behind off a brilliant short-of-a-length delivery.
New Zealand slumped further after Tom Blundell suffered a horrendous dismissal when he hit a short-and-wide delivery from Green to cover with Labuschagne completing a fine catch diving to his left.
Green sheepishly covered his mouth after the dismissal, but he was soon left frustrated when Labuschagne spilt Kuggeleijn after diving low to his left at third slip. Kuggeleijn made them pay with a valuable 44 before being the last batter dismissed.
Having captured just two wickets in the series before this innings, Cummins bent his back and again showed his knack for making things happen on flat surfaces.
After bowling a terrific spell late on day two, where he claimed the key wicket of Kane Williamson for 51, Cummins took the only wicket of the morning session when he dismissed opener Tom Latham for 73.
If they do end up falling short, New Zealand might rue four of their specialist batters not converting fifties into centuries. Resuming at 134 for 2, Latham eyed a first Test century against Australia having overtaken his highest previous score of 63.
But his bid for an elusive century against Australia ended when Cummins, bowling from around the wicket, cut through him with a delivery that reared sharply off the surface. It appeared to take Latham on the back pad and there was only a half-hearted appeal from behind the wicket, but Cummins wisely decided to review after consulting with Carey.
Ravindra and Mitchell took over with a supreme partnership, forcing Cummins to revert to Head and Labuschagne either side of lunch as Australia used eight bowlers. Just before the second new ball, Labuschagne unfurled his seamers and focused on bowling short with speeds reaching 130 kph. The tactic almost proved a masterstroke when Ravindra top-edged just short of long-leg.
After that somewhat amusing over, Australia took the second new ball and it did the trick, but the twists and turns continued to set up a grandstand finish.