Muguruza, who won the WTA Finals title at the end of last season, was cruising at 6-0 3-0, but 31-year-old American Riske, despite tossing her racquet in frustration, refused to give up. Incredibly, she won 12 of the next 13 games to reach the third round at the expense of the world No.9.
"After the first set, it literally could not get any worse," Riske said after a 0-6 6-3 6-1 success.
"So if I could try to get two balls in the court we might get somewhere. I was just trying to hang in there. I've played Garbine many times before and it's always been a battle."
This was Riske's fifth match against Spanish star Muguruza, and despite losing the first two of those, she had since beaten the two-time grand slam winner twice, albeit most recently at the 2019 US Open.
"I felt if I could get in there a little bit, I was going to have my chances," Riske said. "I know I've beaten her before, and if I could just bring out some of my game, good things were going to happen."
It was world No.53 Riske's 10th career victory against a player ranked in the top 10.
British player Harriet Dart pulled off a shock win over Ukrainian Elina Svitolina, as the world No.122 snatched a 2-6 6-3 6-3 victory over the No.12 seed.
Three of the biggest names in the draw took the long route through to the round of 32 stage, with Emma Raducanu, Simona Halep and Iga Swiatek taken to a deciding set in their opening matches, having benefited from first-round byes
Raducanu fended off Caroline Garcia 6-1 3-6 6-1, while Halep was a 6-2 4-6 6-2 winner against Ekaterina Alexandrova, the Russian who is playing under a neutral flag.
Polish No.3 seed Swiatek put a slow start behind her to beat Ukrainian Anhelina Kalinina 5-7 6-0 6-1 and is looking to build on her recent Qatar Open triumph.
She said: "I'm pretty happy I could turn my head on to fight mode and stay focused, because that was the key I guess."
Last year's Wimbledon runner-up Karolina Pliskova bowed out, the No.7 seed from Czech Republic losing 2-6 7-5 6-4 to Danka Kovinic from Montenegro.