Australia has a fight on its hands to win the second Test in Christchurch, requiring 202 runs to win with six wickets remaining.
New Zealand was bowled out for a hard-earned 372 runs, with Rachin Ravindra (82) and Scott Kuggeleijn (44) impressing with the bat for the hosts.
With a challenging victory target of 279, Australia's top order slumped to 4-34 after a stunning new ball burst from Matt Henry and Ben Sears.
Travis Head (17*) and Mitch Marsh (27*) steadied the ship for Australia to help set up a thrilling conclusion to the two-Test series.
New Zealand resumed on 2-134, knowing that a long batting day could help set up a rare Test victory against their trans-Tasman cousins.
But with early wickets vital for Australia, Pat Cummins stepped up to deliver the key scalp of Tom Latham for 73.
Cummins seamed a ball back through Latham, though initial appeals for caught behind were given not out. A tentative review showed there was a tiny inside edge on the ball before it hit Latham's back pad, and the opener's innings ended on 73.
However, Australia was never given the opportunity to build momentum, as Ravindra and Daryl Mitchell combined for a significant morning partnership.
The pair batted sensibly but with purpose, and added 109 runs to the hosts' lead in the first session alone as Australia toiled on a flat pitch with an old ball.
Both Ravindra and Mitchell claimed deserved half-centuries, and continued to impress even after Australia had taken the new ball.
Australia's first innings hero Josh Hazlewood was the man to break the partnership with a gorgeous delivery that feathered Mitchell's outside edge, removing him for 58.
Not to be outdone, Cummins produced a delivery of equal quality from the first ball of a new spell to dismiss Ravindra. Cummins's opening salvo squared Ravindra up and seamed sharply across him, catching a fine edge through to Carey.
Tom Blundell's stay was short and his exit disappointing, skewing a horrible Cameron Green delivery towards Marnus Labuschagne at cover for just nine. Labuschagne had a lot to do and took a wonderful catch, but neither the ball and shot were worth replaying.
Australia's hopes of a swift conclusion were dashed by Scott Kuggeleijn, who came out swinging and added a quickfire 44 to take the lead beyond 250, having been dropped on 2 by Labuschagne at slip.
Frustrated but patient, Australia picked off the final remaining wickets quickly after tea. Nathan Lyon bowled Glenn Phillips (16), before the spinner lured Matt Henry (16) into holing out at long on.
Tim Southee (0) played catching practice with Carey from a Cummins short ball, and Kuggeleijn went down swinging, caught on the rope while trying to hit Lyon for the six that would have earned him a half-century.
That bought Australia back out to the middle chasing a challenging 279 runs to win the Test at the same ground where New Zealand dramatically made 8-285 to beat Sri Lanka with the final ball of the Test last year.
The chase didn't start well for Australia though, Smith falling LBW to Henry for nine after being trapped by a ball that nipped back venomously off the deck.
Labuschagne departed following a furious burst from debutant paceman Ben Sears.
Sears found the edge of Australia's number three with the second ball of his first over, only to see Mitchell drop him at second slip after diving late to his right.
It mattered little though, just two balls later Labuschagne (6) clipped a leading edge back to the bowler, who stooped down to claim the catch before roaring with delight along with 8,000 of his countrymen in the stands.
Henry was on song at the other end, bowling a marathon nine-over stint constantly pressuring the Australian batters.
Fresh from his seven-wicket haul in the first innings, the Christchurch local had his home-town crowd up again soon after as Khawaja (11) was caught brilliantly by Southee at third slip.
When Cameron Green was bowled by Sears for just five, Australia was teetering on the brink at 4-34 in front of a pumped up Hagley Oval crowd.
However, Head and Marsh steadied Australia to set up an enthralling final day.
Look back on how all the action unfolded in our live blog.
THAT'S STUMPS! Australia 4-77 need 202 runs to win
New Zealand's day from start to finish. The Black Caps are as close as they have been to a home Test win over Australia for 33 years.
Australia just let the target get away from itself through a couple of patches of play with the ball, firstly as the Mitchell-Ravindra partnership grew before lunch and then when Scott Kuggeleijn blasted 44 critical runs around the tea break.
The story of the afternoon is Australia's top order collapse, sparked by some sensational bowling by Matt Henry and Ben Sears. New Zealand took four quick wickets to grab this game with both hands, and were unlucky not to add another one or two before stumps.
But this Test is not over. Australia's bottom six certainly has the ability to make the 202 runs required for what would now be a memorable win. This Head-Marsh partnership will be key, and both men will look to get things moving quickly tomorrow morning.
The Test will be won and lost tomorrow. Please come back to join me and Simon in the morning, becuase we will be watching a little bit of history no matter which way the result goes. See you then.
24th over - Southee will bowl the last over of the day
The skipper has the ball and Marsh has the strike. This will be the last over of an engrossing day.
Marsh gets off strike immediately with a single to midwicket.
Southee is short, and Head ducks under it. Four to come.
BEATEN! So close for Tim Southee! From around the wicket, that did everything right except take the nick. Head survives, three to come.
Head defends solidly on the back foot. Two to come.
Head defends to mid on now, watching it like a hawk. One to come.
The final ball of the day strikes Head on the pad, they take a leg bye and retreat to the sheds at long last.
What a day for New Zealand.
23rd over - Phillips to bowl another
Head leaves another wide one. He won't be doing that tomorrow.
Now the field comes in tight around Head, but Phillips still can't get him playing.
Head is forward and defending. Excitement around the bat, but that was well played.
Now Head cuts, and a misfield at point allows him a single.
Marsh crunches the last ball of the over down to long off. Probably time only for one more.
22nd over - Southee in again
Blundell still up to the stumps with Marsh on strike.
Marsh squirts one wide of gully and will take two.
Nice take from Blundell as Marsh leaves a wide one.
Marsh is still having a crack at some cover drives, but without much purchase yet.
Just the two from that over. Australia nearly through to stumps.
21st over - Glenn Phillips into the attack
Looks like the light is an issue. The part-time spinner is on now as New Zealand try to sneak one more wicket out tonight.
Travis Head is playing as few shots as possible. Phillips is trying to tempt him with the wide ones, but he's fighting that devil on his shoulder.
Eventually Head gets the straight one and takes a single.
Marsh advances and drives to long off for a single to finish the over.
20th over - Tim Southee back into the attack
The skipper has the ball back in his hand and Head on strike.
Four defensive strokes in a row from Head. He's got stumps on his mind.
Southee nearly sneaks an inswinger through Head's defences, but he gets the bat down in time and takes a single.
Over bowled, one from it.
19th over - Sears to steam in again
Head on strike, and driving straight back to the bowler.
Too straight that time from Sears and Head takes the single out into the deep. It does look to me like Travis Head is going to put the shots away between now and stumps.
SLASHED FOR FOUR! Marsh, on the other hand, will not. He saw a bit of width and threw the hands at it. It wasn't far away from point, but he gets away with and banks the boundary.
Sears gets his line and length just right to end the over. We've got a little under 20 minutes left in the day.
18th over - Henry is still in the attack
They can't get the ball out of his hand. Probably fair enough too.
Henry is coming around the wicket to Head.
FOUR RUNS! A rare bad one from Henry. Down the leg side and easy to clip for four for Head.
Again on Head's hip, but he takes just a single this time.
Five runs from the over, Henry just slowing down a little now through fatigue.
What's next for Australia's Test team?
I heap a lot of smack talk on Bazball. But have to also acknowledge we are also drinking out own coolaid. Thinking Smith is an opener. Going in with two all rounders and one less specialist. Its all just completely against everything we have learnt over 150 years of chasing leather for five days.
- Chris
A few times this summer I've flagged that the next few years for Australia's Test team is going to be one of significant transition and probably mixed results. A lot of players are reaching the end at once, and the next generation has not had any exposure to the level.
The Australian public was accepting of the Ashes fade-out as the urn was retained. It was okay with the Windies loss because of the magic of the moment, and of Shamar Joseph himself. This one, should it play out as it looks like it will play out, will raise more eyebrows.
Be very, very wary of India next summer. That is a series that could effectively bring about the end of this current Australian team, unless something seriously changes between now and November.
17th over - Sears continues
EDGED FOR FOUR! Marsh throws the bat at a wider one and gets a thick edge over the cordon. His intentions have been flagged.
Marsh pulls hard out to square leg, and takes the single.
EDGED FOR FOUR! A loose shot from Head outside the off stump, but it's wide of the cordon. That was a genuine nick, Head got away with one there.
Half a shout as Head misses one down the leg side. Don't think that was miles from the leg stump.
One more for Head, over bowled.
16th over - Here's Henry
Head gets one on his thigh and works it to square leg for a single.
This Head-Marsh partnership is one that has the potential to change a game very quickly. That's why they're both in the team, I guess. But right now, it's all about damage limitation. Save the heroics for tomorrow.
EDGED FOR FOUR! Between slip and gully, but well short of both. Marsh banks the boundary.
Blundell is up to the stumps again to Marsh, who has walked at the bowler a couple of times already.
Marsh edges again through the gully, but it won't reach the boundary. He'll take two.
Lovely shot from Marsh, up on the back foot and driving through the covers. Williamson chases it down, and they get three.
Over bowled.
15th over cont - Sears has four to come
Mitch Marsh is in the middle now, on a pair. He's actually looking down the barrel of three consecutive ducks. I don't know what you'd call that.
FOUR! Don't worry about finding a name for that. He gets a loose one on his pads first ball and whips it to the square leg rope.
BEATEN! And Sears follows up with a cracker. Good pace, good swing, much too good for Marsh.
Sears is wide for the rest of the over and Marsh leaves them alone. Hagley Oval voices its appreciation for the young quick.
BOWLED HIM! CAM GREEN CHOPS ON! BLACK CAPS ON FIRE!
What did I say about Cameron Green being tentative? He wasn't sure whether to leave it or defend it, and in the end succeeded only in chopping it back down into his own pegs.
A poor dismissal brought about by fantastic bowling by these Kiwi quicks. The pressure is proving far too much for Australia this afternoon.
15th over - Sears to pick us back up
There's about 45 minutes left to play today. Australia absolutely can not afford to lose another wicket.
Australia's batting woes
Smiths opening stint has been a disaster. What do Australia do with their batting order now?
- Harry
We've had a good look at this Australian order now. Aside from the Smith opening switch, it has basically been the same since the third Test in the Ashes. Presuming Australia drops this Test, the record since then would read five wins, one draw and four defeats.
The balance isn't right. It's too slow at the top with Khawaja and Labuschagne and too aggressive in the middle with Head and Marsh. Players are out of form, but that is being exacerbated by the lop-sided nature of the batting order. In my opinion, anyway.
When India comes to town next summer, I think square pegs need to be reinserted into square holes. There might only be room for one of Green or Marsh in the line up. Head might need to bat six, and only move up depending on the situation. There needs to be an opener up there with Khawaja, and I don't really care whether it's Bancroft or Renshaw or someone untried. It's a bit of a muddle right now, and has been out of whack for nine months now.
14th over - Henry on his way back in
And Blundell has come up to the stumps to keep Green from marching down the wicket.
It's a good tactic, but the downside is when Blundell cops one right on the end of the finger, shatters his finger and concedes a bye. Which is what happened there.
Head flicks off his pads and is off the mark with two.
He sees out the rest of the over, and they'll be relieved to take a drinks break.
13th over - Sears to bowl another one
Green on strike. There is a buzz around Hagley Oval now. You can bet there will be sick days being taken tomorrow as the city of Christchurch comes to see what could be a memorable win over the Aussies. Long way to go yet though.
Cam Green is planting that big front pad and defending for his life. He is much more comfortable going into his shell than Head, but it doesn't always work out for Green when he becomes tentative.
Green takes a single out to square leg.
Feels like Head is the key here. He's either going to win this Test off his own bat or leave his team in the muck.
Over bowled.
12th over cont - Henry has three to come
Travis Head is the new man in. I wonder if he will curb his natural instincts at all, given the scenario, or if he will try to smack Australia out of trouble again.
Henry swings in a couple of really full balls at Head's toes, and he just about keeps them out.
As an aside, we had another very lengthy review of that Southee catch, even though he took it about six inches off the ground. To my point from earlier in the day, what are we doing here?
Head survives three balls. Henry is on fire and the Black Caps can taste a famous victory here.
GONE! KHAWAJA ON HIS WAY! Henry has another and Australia is crumbling!
What a screamer from Tim Southee at third slip! A thick outside edge from Khawaja looked like it was flying well wide of the cordon, only for the Black Caps' skipper to fly to his left and drag in an absolute hanger.
This is spectacular stuff from New Zealand, Australia all the way on the ropes now.
Sports content to make you think... or allow you not to. A newsletter delivered each Friday.