The 24-year-old overcame a difficult start and tricky second serves to prevail 4-6 6-3 6-4 in two hours and 28 minutes, denying Wimbledon champion Rybakina a second major title in the space of 12 months following a memorable back-and-forth battle.
Browsing: Elena Rybakina
The defending champion served for her third round match against Leylah Fernandez but fluffed her lines.
Having come into the tournament with low expectations, Williams had looked solid through her first three matches, and, with big names falling by the wayside, the American surged up the list of title favourites.
The world number six, who ended the year as world number one in 2017 and 2018, withdrew when trailing 5-4 in the first set against the Kazakh wildcard.