Azarenka dropped the first set to Dominika Cibulkova in decisive fashion and was down 1-5 in the second frame when she recovered, winning five games in a row.
The Belarus star eventually went on to post a 1-6, 7-6 (9-7), 7-5 victory over the 16th-seeded Slovakian to stay perfect on the season at 26-0 while advancing to the quarterfinals, where she will face No. 7 seed Marion Bartoli of France, who routed 22nd-seeded Russian Maria Kirilenko 6-1, 6-2.
The 10th-seeded American superstar Williams, a five-time Miami champion, dispatched No. 6 seed Samantha Stosur of Australia 7-5, 6-3, exacting a bit of revenge for the Aussie's upset of Williams in last year's U.S. Open final.
The 30-year-old Williams unleashed 20 aces Monday in a quest for her first Miami crown since 2008.
Sharapova overcame 11 double-faults to down fellow Russian Ekaterina Makarova 6-4, 7-6 (7-3) and advance to the quarterfinals. The former world No. 1 was last year's Miami runner-up, losing in the final to the currently top-ranked Azarenka.
Fifth-seeded Pole Agnieszka Radwanska beat Spanish wild card Garbine Muguruza Blanco 6-3, 6-2.