Williams was not helped by a jarred ankle early in the deciding set that required heavy strapping and her quest to equal Margaret Court's record of 24 grand slam singles titles goes on.
Instead it is two-time Australian Open champion Azarenka who will face Osaka in a quite remarkable story of resurgence.
The 31-year-old had been a shadow of her former self since her stop-start return from maternity leave in 2017 and had almost been written off as a major contender prior to her victory on the same courts in the Western & Southern Open last month.
A lengthy custody battle with her former partner over their three-year-old son, Leo, kept her away for several spells and took its toll on and off court, while her confidence ebbed away.
This was the former world number one's first slam semi-final since her second consecutive final against Williams in New York in 2013, both of which were high-quality, close affairs but both were won by the American.
But this was every bit as good, with Azarenka continuing the form that saw her lose just one game against Elise Mertens in the quarter-finals.
Azarenka helped her with a nervy first service game and Williams needed no second invitation to crush her opponent's weaker second serve.
In no time she was 4-0 up, and in just 34 minutes she wrapped up the opening set.
It seemed a minor setback when Williams missed the chance to break for 2-0 in the second set, but that gave Azarenka a foothold and she grabbed it, playing a superb return game to move 3-2 in front.
Azarenka's backhand in particular was really firing now and she began to dictate from the middle of the court, marching to her chair after breaking for a second time to win the set.
Suddenly it was Williams needing to change the momentum, and what she certainly did not need was an injury to her troublesome ankles.
The 38-year-old clutched her left ankle as Azarenka made it deuce in the second game of the deciding set, and the Belarusian broke after a lengthy medical timeout.
Williams threw everything she had at Azarenka as she tried to claw her way back into the match, her screams reverberating around the empty Arthur Ashe Stadium.
But Azarenka held her nerve superbly and got the sweetest of rewards, sealing victory with an ace for her first win over Williams at a slam in 11 tries.