Williams, 38, was the bookies’ favourite to win an eighth title at Melbourne Park but she came unstuck against a determined Wang, who took only one game off the American last time they met.
The 6-4, 6/7 (2/7), 7-5 upset means Williams, whose last Major win was at the 2017 Australian Open when she was pregnant, has fallen short at eight Grand Slams since returning from having a baby in 2018.
“I think my team always believed I can do it,” said 27th seed Wang, who lost 6-1, 6-0 to Williams in last year’s US Open quarter-finals.
“After last time I did really hard work on and off court, I believed I could do it.”
Her reward is a clash with Tunisia’s Ons Jabeur, who upset Williams’ close friend Caroline Wozniacki, sending the Dane into retirement.
Williams, seeded eight, started slowly against the fast, positive Wang, and she was three break points down in the ninth game when Wang punched away a forehand to grab the break.
Serving for the set, Wang won a full-blooded rally to bring up set point and then sealed it to go one set up — a far cry from their last meeting in New York.
Williams came out firing for the second set but her chances plunged when she was broken to go 3-2 down, and it looked all over when she let Wang off the hook on break point in the eighth.
However, Wang wobbled when she was serving for the match and Williams won a titanic 24-shot rally to break the Chinese player for the first time, raising her arms in triumph.
Williams staved off more break points before dominating the tie-breaker, where she benefited from another net cord and a Hawk-Eye review before levelling the match with a service winner.
In the tense final set, both players held firm but Wang pounced when Williams was serving to stay in it, converting her third match point as the American netted.
Wang received a torrent of criticism from Chinese fans after her capitulation to Williams in the last eight at Flushing Meadows.
The 28-year-old from Tianjin has now achieved her deepest Australian Open run, after reaching the third round last year — a prelude to her best Major performance, at the US Open.