It was the second consecutive five-setter this week for three-time major champion Murray, a 35-year-old from Britain with an artificial hip who eliminated No. 13 seed Matteo Berrettini on Tuesday.
Kokkinakis is a 26-year-old from Australia who is ranked 159th and has never been past the third round at a Grand Slam tournament.
Somehow, this was not the latest finish in Australian Open history. A 2008 match at the tournament between Lleyton Hewitt and Marcos Baghdatis concluded at 4:34am., the record for any Slam.
Kokkinakis could have closed out the proceedings far earlier, having taken the opening two sets and been up a break in the third. But serving at 2-0, 40-all, he was cited by the chair umpire for taking too much time before a serve and let it get to him.
First Kokkinakis lost the argument, then he lost his focus, getting broken there and destroying his racket by spiking it on the court.
Still, he served for the match at 5-3 in that set, and came within two points of victory, before Murray pulled it out when Kokkinakis flubbed a volley to cede the eventual tiebreaker.
In the fourth, Murray was the aggressor and never seemed sapped of energy, at one point waving his arms and even doing jumping jacks to fire up his supporters. His mother, Judy, repeatedly rose to her feet to clap and yell; his coach, Ivan Lendl, did not, sticking in his seat.
When Murray delivered a second-serve ace at 2:59am., more than 4 1/2 hours into the proceedings, he owned the fourth set and forced a fifth.
That last set was, appropriately, even as can be for 10 games. There were zero breaks of serve until Murray finally converted his eighth chance of that set with a forehand winner to lead 6-5. He strutted to the sideline, shaking his neon-colored racket.
All that was left to do was serve it out, and Murray managed to do just that, wrapping up the longest victory of his career with a backhand winner. After meeting Kokkinakis at the net for an embrace, Murray screamed.