The 24th seed Muguruza stunned Williams in the second round at Roland Garros and another upset looked on the cards as the rising 21-year-old tore through the first set with a barrage of winners from the baseline.
Top seed Williams woke up and her serve, so often her saviour, became almost impenetrable. After saving six break points in a marathon second game of the deciding set, Williams then broke Muguruza twice before sealing the match when her opponent blasted a forehand long.
Williams will play last year's losing finalist Dominika Cibulkova for a place in the semi-finals.