New Zealand 179 and 111 for 3 (Ravindra 56*, Mitchell 12*) need 258 runs to win Australia 383 and 164 (Lyon 41, Phillips 5-45, Henry 3-36)
Ravindra endured several anxious moments, including Lyon's lbw appeal which failed Australia but gave New Zealand hope of a remarkable victory. In tough conditions, Mitchell channeled his innate aggression to finish with an unbeaten 12 off 63 balls.
New Zealand will have to rewrite the record books if they are to take the lead in the series, the highest run chase by Pakistan being 277 for 3 at Basin Reserve in 2003.
But New Zealand's chase got off to a poor start, with opener Tom Latham gifting Lyon a wicket when he nicked a delivery short and wide on Dee's stroke. Lyon, who came into the attack in the sixth over, dismissed a big catch behind Williamson's first-ball appeal and Australia lost.
Williamson, who smashed three centuries in four innings against South Africa, was determined to make amends after his horrific run-out in New Zealand's first innings for a duck.
After a rare double defeat, Williamson was annoyed with himself as his modest career mark against Australia dropped to 37.26 compared to 55.25 overall.
Lyon's performance was promising despite Australia's mid-session collapse that strangled them.
As they look for a rare Test win against Australia, New Zealand have at times been scared out of their wits in the series opener. But Phillips top-scored with a disappointing 70-ball 71 in New Zealand's first innings of 179.
Mitchell Santner, the leading spinner in the match, stood up with the ball after being overlooked. Having stumped Usman Khawaja in the first session, Phillips took the wickets of the head and in-form Mitchell Marsh in successive balls after lunch for New Zealand.
Head, who conceded just one run in his last three innings, scored 29 off 36 balls before being dismissed at long-off. Marsh was caught at short leg for a golden duck and Phillips equaled his best of four wickets in an innings.
Phillips was denied the sixth spot when Cummins was dropped twice, but Matt Henry took the last two wickets to end New Zealand's fightback – finishing with eight for the match.
Having never taken a five-wicket haul in first-class cricket, Phillips became the first New Zealand spinner to achieve the feat at the Basin Reserves since 2006 when Australian coaching staff member Daniel Vettori took seven for 130 against Sri Lanka. .
A New Zealand rally was unlikely when night watchman Lyon dominated the first 30 minutes of the game. Lyon's highest score of 47, the highest score in Test history without a half-century, was dismissed after his innings-high 41 off 46 balls.
Lyon's landmark bid came to an end after Henry hit the onrushing Young at midwicket, but he returned to action later in the day's play.
Tristan Lavalette is a journalist based in Perth