The American world number one, who lost to Muguruza at last year’s French Open, came through 2-6 6-3 6-2.Williams next faces Slovakia’s Dominika Cibulkova, who beat two-time champion Victoria Azarenka 6-2 3-6 6-3.
Defending men’s champion Stan Wawrinka beat Guillermo Garcia-Lopez 7-6 (7-2) 6-4 4-6 7-6 (10-8).
Madison Keys backed up her win over fourth seed Petra Kvitova by beating fellow American Madison Brengle 6-2 6-4, while Novak Djokovic and Kei Nishikori are among the men in action later on Monday.
Williams was in danger of another defeat by Muguruza as the Spaniard attacked her second serve mercilessly in the early stages.
The Spaniard then had six chances to break in a game of eight deuces at 1-1 in the decider but Williams clung on, despite a mid-game coughing fit.
“I think I caught that bug,” said the American. “I’ve just been sick. I’ve been fighting it with vitamin C and all kinds of stuff. But I just have a really bad cough.”