After Djokovic held at love, Kohlschreiber held his nerve to finish it off, gaining a match point when Djokovic's lunging backhand went wide before Kohlschreiber fired a sideline-skimming forehand.
"It's a very special win today", Kohlschreiber said after the match. "I had a great strategy to play against him". I had two good wins [entering the match]. So everything came together.
Spain's Muguruza, a two-time Grand Slam champion now ranked 20th in the world, out-lasted seventh-ranked Kiki Bertens 5-7, 6-1, 6-4 while Williams, a seven-time Grand Slam victor, beat Germany's Mona Barthel 6-4, 6-4.
"Unfortunately the tournament is not over". "I would say after 3-all in the first set I felt like getting closer to the set, holding my service games, which is not easy against Novak, because he's such a great returner", Kohlschreiber said. "I mixed up the pace a lot".
Kohlschreiber posted his first victory over a top-ranked player, advancing to a fourth-round match against France's Gael Monfils.
Five-time champion Djokovic suffered a shock 6-4 6-4 defeat against the German in California, the top seed unable to see off Kohlschreiber when they resumed after a rain delay on Monday.
Novak Djokovic had no answer
Federer next faces Britain's Kyle Edmund, who beat Macedonian qualifier Radu Albot 6-3, 6-3.
On Tuesday, the 23rd-ranked Bencic served and returned better. Bencic captured the Dubai title last month.
This win was her first victory over a No. 1 not named Williams. "I'm really excited about that". "So it's a positive victory for me". "Honestly, she was just playing so well, and she's such an incredible player".
The top-seeded Serb, who had not dropped a set in four matches since the round of 16 at the Australian Open in January, looked out-of-sorts throughout the 98-minute contest.
In addition to the top seed falling on the women's side of the draw, the second seed, Simona Halep lost to teenager Marketa Vondrousova 6-2, 3-6, 6-2. "So these are the rare occasions where I could potentially do well", Djokovic said. "But it's everything I could do today".
Bianca Andreescu, an 18-year-old Canadian, beat 18th-seeded Wang Qiang 7-5, 6-2.More news: Arsenal's 2-goal Aubameyang explains mask mystery
More news: Android Q Beta 1 released for all Pixel phones; New features revealed
More news: Rockets fired from Gaza target Tel Aviv for first time since 2014