The Romanian, coachless after a mutual parting with Darren Cahill, lost her fifth consecutive match dating back to Cincinnati last year. Barty advances to the last eight to face tenth seed Elise Mertens.
Barty takes close first set
The Aussie served first and was immediately pushed to deuce before a big serve got her to game point and a fine drop shot to seal an opening hold. Barty displayed her all-around game to get out of trouble in her next service game to hold for a 2-1 lead.
All eyes were on Halep, recovering from, among other things, hernia surgery and she faced a break point in the fourth game, converted by the Aussie when the top seed netted a backhand off of a chip backhand from Barty.
The Romanian was back on level terms after breaking straightaway and the set was finely poised as it headed to the latter stages. At 5-4 ahead, Barty held set point after winning a long exchange and used her slice once more to force an error from Halep to take the lead.
Aussie seals famous win to reach last eight
The Aussie opened the second set with a commanding hold and was threatening to run away with the match, holding three break points in the second game, but Halep was able to fight off all three to hang on to her serve.
Barty dug out of 15-30 to post a hold and was again under pressure facing a 15-40 deficit. After saving the first, the Aussie erased the second on a series of slice backhands, Halep finally misfiring with a backhand wide, the world number 15 eventually holding for a 3-2 edge.
The Romanian made the first breakthrough of the set, winning a long rally on break point to make a 4-3 lead. Her momentum was short-lived as Barty broke back and held, saving a break point to heap the pressure back on Halep.
Serving to stay in the contest, the top seed was pushed to deuce and eventually stared down match point, Barty claiming victory on a 17-shot rally after Halep dumped a backhand into the net to leave Sydney with more questions ahead of the Australian Open.
Barty speaks about her victory
"I certainly fear no one and I feel like I can go out there and match it with the world's best", Barty said following her first career win over a reigning world number one. "I think it's (beating the world number one) all blown out a little it. For me, it's another tennis player across the court.
"Yeah, I respect Simona. She's done amazing things in this sport. It's about going out there and just trying to play the person on the other side of the net and not their reputation".
After losing twice to Halep last year, the Aussie joked "I finally learnt my lesson. She gave me a belting in Montreal. I learnt a little bit more in Cincinnati, but today I knuckled and really thought about it and really gave myself a chance.
"The biggest thing, I believed that I could win. We're both out here on the same court. Just very happy I could come out here and execute".
Halep left with more questions ahead of Melbourne
After losing in the opening stage at a tournament for the fourth straight event, Halep maintained a positive outlook despite the setback: "I think it was a great match after almost four months since I played a full match.
While she felt "I think I played a good level of tennis. I had no inspiration in some important points", she was quick to praise Barty, who she stated "she played really well. Her slice was great today, so yeah, she deserved to win this match.
"But also I was very close to winning. I had so many chances to break her and to take advantage, but I couldn't".