Tomljanovic, the Australian No.2, had every chance to put the match to bed but she faltered at the crucial moment, while Halep reeled off five games in a row to take the deciding stanza 7-5 and advance to the third round.
“I was expecting that she was going to play very hard and strong. I expected it was going to be a difficult match, but it was more than I thought,” Halep said in her courtside post-match interview.
After two sets, the pair were absolutely equal, Tomljanovic having taken the opening set 6-4, Halep the second set by the same margin.
Both had been weak on serve, losing several service games in succession, but both had found some excellent shots to produce winners when they needed to dig deep and show the sort of self-belief required to progress in grand slam tournaments.
Halep, of course, has done so with regularity over the years, hence her lofty status, and it looked right at the outset as though this too would be a regulation triumph in line with the rankings as she galloped to a 2-0 lead, breaking Tomljanovic’s serve in the first game and then holding her own.
But that was to prove illusory in a first set that would eventually take almost an hour to be completed.
The Australian held her serve and then broke back, beginning a series of tight, taut and tense games where advantage and deuce were the most frequent scores.
Whenever one player looked to have the advantage, the other rallied and broke serve as neither could break clear.
When the first set breakthrough came, it was the tall Australian who made it in the 10th game.
She had attacked Halep’s forehand and second serve, used the drop shot well and built up pressure.
The second set was where Halep dug in and although there were again plenty of service breaks, the higher-ranked player kept her cool.
This then, was going to be a test of nerve, resolve, fitness and strength.
Tomljanovic was quick out of the blocks and looked to have the game at her mercy when she raced to a 5-2 lead, the world No.2 on the ropes and looking out of sorts and ideas.
But Halep clawed her way back to 5-4 with a break of serve and despite a double fault at a crucial stage of the 10th game managed to level at 5-5 by serving an ace to win the game.
Despite having trailed for almost the entire match it was Halep who came to the fore at the critical moment, breaking Tomljanovic in the 11th game to take a 6-5 lead to set up her triumph.
Japanese star Naomi Osaka had a much less worrying evening than Halep, easing into the third round with a straight-sets win over Frenchwoman Caroline Garcia.
Michael Lynch is The Age’s chief soccer reporter and also reports on motor sport and horseracing