It was Halep's first match since October after a lengthy layoff due to a herniated disc in her back.
Halep had the first break of serve in the second set and even served to make it 5-3 but Barty rattled off successive breaks to take the set 6-4 and complete a straight-set win over the French Open victor. Her slice was great today, so, yeah, she deserved to win this match.
Earlier, two-time major champion Garbine Muguruza was left with no option but to give her opponent Kiki Bertens a walkover before her second round match.
Her play improved from there. "In extremely tricky conditions, [I was] very happy with the way I was able to keep it kind of together".
"No pain at all, that is a great sign", she added of her back.
"I dug myself into a little bit of a hole there, but I just said, "Look mate, be aggressive", Barty said.
Halep, without a coach after splitting with Darren Cahill who wanted to spend more time with his family, was first to break in the second set and had a chance to hold for 5-3.
The 22-year-old struggled after missing the first but she did enough to prevail as the victor, fending off nine out of 11 break points she faced to seal the deal and celebrate a huge triumph after believing in herself all the time, even when she was a break down in set number two.
"It was extremely hard conditions, very swirly down at court level". However, the Aussie's relentless play made for compelling viewing and resulted in another break of serve for her as she went on to pocket the first set.
"I finally learned my lesson", said Barty, who had suffered two straight-sets defeats by Halep a year ago.
"I had nothing to lose out here so I just came out and played with freedom. I believed I could win".
Barty, ranked 15 in the world, surged into the quarter-finals in Sydney with a 6-4, 6-4 triumph over the reigning French Open champion and 2018 Australian Open runner-up.
American world number five Stephens was another casualty.
Belarusian Sasnovich defeated Priscilla Hon 0-6 6-3 6-3, while Bacsinszky also came from a set down to beat an Australian player, winning 5-7 6-4 6-3 against Sam Stosur.
In the men's draw, third seeded Argentine Diego Schwartzman booked his place in the quarters by beating Spain's Guillermo Garcia-Lopez in two sets.