She ensured that she would finish top of her pool with a 6-4 6-4 triumph over Azarenka, whom she has beaten in 11 out of 12 professional meetings.
The Belarusian's serve plagued her during the first set as she dropped nine double faults, including one to gift Williams the opener.
Despite regaining her composure to take a 3-0 lead in the second, Azarenka was overpowered by Williams's superb power hitting as the American won the next four games.
The two players traded games on serve before Williams held in the tenth game of the set to claim a comfortable victory.
Azarenka can still advance to the last four with a victory over Li on Friday.