Osaka overpowered Su-Wei Hsieh 6-2, 6-2 to reach the semifinals earlier in the day and is expecting a tough match at the next stage.
"Normally, I never look at my draw,'' Osaka said. "But everyone has told me about my draw here, so I kind of had no choice but to know who my next opponent is. It's definitely going to be really fun.
"She's Serena. I feel really intimidated when I see her on the other side of the court.''
As well as she played at the start of her Australian Open quarterfinal, Williams was struggling early in the second set.
Williams was always in front in the first set but needed to dig deep to wrestle back the momentum after Halep took a 3-1 lead in the second.
After one mistake against No. 2 seed Halep -- who won the last time they played each other -- Williams pointed at her racket strings and made a sour face, as if to make clear it wasn't truly her own fault. After another, Williams looked up at her guest box with palms up and asked: "What is happening?"
Eventually, however, Williams broke for 4-3 after a 13-shot rally where she showed incredible athleticism to get to a couple of shots that would have defied most players.
Seven minutes later, she wrapped up the contest with a huge forehand, her 24th winner.
"I think this was the best match I have played at this tournament for sure," Williams said after.
"I knew it had to be going up against the No. 2 in the world. I had to be better and I was, so I'm excited."
This will be Williams' and Osaka's fourth career matchup -- all on hard courts -- and the latter leads 2-1, the most memorable encounter, of course, coming in the final of the 2018 US Open.
"She's a great player on the court and an inspirational person off it," Williams said.
"I feel this is a great opportunity for me just to do my best in the first Grand Slam of the year."
Seeded third, Osaka reached 122 mph on her serve against Hsieh. She hit seven aces, lost only two points on her first serve and was never broken en route to her 19th consecutive victory.
Osaka also played excellent defense, such as in the final game, when she raced forward to chase down a drop shot, flicking a backhand cross-court for a winner.
"I couldn't afford to be lazy with my footwork,'' Osaka said with a smile. "I didn't want to play three sets.''
At 35, Hsieh was the oldest woman to make her Grand Slam quarterfinal debut in the professional era. But Osaka wasn't fazed by Hsieh's flat, deceptive, two-handed strokes from both sides, pounding forehand winners into both corners.
Hsieh said Osaka is a threat to win the championship.
"She always can go all the way,'' Hsieh said. "She just needs to play her game and stay calm. She's a great player.''
Osaka's winning streak includes a US Open title in September for her third Grand Slam championship. The streak also includes her fourth-round win last week, when she saved two match points and swept the final four games to overtake Garbine Muguruza.
"It makes me a bit more calm, knowing that my back was severely against the wall,'' Osaka said.
In women's doubles action, the extended run of the young American team of Coco Gauff and Caty McNally ended in the quarterfinals with a 7-6 (4), 6-1 loss to the fourth-seeded team of Demi Schuurs of the Netherlands and American Nicole Melichar.
Gauff and McNally had a 4-1 lead in the opening set before a series of unforced errors allowed Schuurs and Melichar to stage a comeback. The winners took a 3-1 lead in the second set after a service break and closed out the match quickly.
The American pair had beaten two seeded teams in previous matches.
The Associated Press and Reuters contributed to this report.