Defending champion Roger Federer was stunned by Japan's Kei Nishikori in the last 16 of the Mutua Madrid Open.
Despite a second-set fightback, the second seed was too often below his best and succumbed in an hour and 35 minutes to end his first tournament back after a two-month break.
However, Andy Murray - who will replace Federer as world number two on Monday - did make through although it took an almighty effort before he eventually fought off Gilles Simon in a little under three hours.
Rafael Nadal also reached the last eight after easing through against Mikhail Youzhny.
Nishikori led by a break in the first set and, although Federer held serve at 3-5 to keep himself in the set, he fired a backhand into the stand at set point as Nishikori took a shock lead.
Federer responded in predictable style, by winning the second set 6-1, but Nishikori broke in the fourth game of the deciding set to nudge ahead once more.
He held to lead 4-1 and then 5-2 and, after a pair of unforced errors from Federer set up match point, the Japanese player completed the break to wrap up a 6-4 1-6 6-2 win.
Federer told the ATP World Tour website: "I'm going to go back to the practice court, train hard, and make sure I don't have these kinds of days anymore. I'm pretty disappointed with my play.
"I'm not sure how well Kei thought he played. I didn't think he had to play his very best either, which is even more disappointing.
"Credit to Kei, the better guy won today."
After Nishikori said "hopefully I'm one of the upcoming players," Federer graciously said: "I think it's exciting and good for the game that not so well known and younger guys are beating the top guys. It's good to see."
Nishikori added on Sky Sports 4: "I think it's the biggest win (yet) for me - especially on clay, it's not my favourite court. It's an amazing day for me."
The result set up a surprise quarter-final against wild card Pablo Andujar, who progressed after fellow Spaniard Daniel Gimeno-Traver was forced to retire at 5-5 in the first set.
Third seed Murray booked a last-eight meeting with Tomas Berdych but only after fighting off some dogged resistance by Frenchman Simon.
Murray lost the first set 6-2 but hit back to level the match by winning the second 6-4 and it seemed that victory was inevitable when he took a 3-0 lead in the third set.
However, the world number 17 consistently clawed his way back when he appeared on the brink of defeat and eventually the match went to a tie-break before the Scot won 2-6 6-4 7-6 (8/6).
It was a sapping match lasting just four minutes shy of three hours and left the Briton little time to recover before his last-eight match tonight with Berdych.
Fifth seed Nadal was scarcely troubled in beating Youzhny 6-2 6-3.
Nadal broke the Russian's serve on five occasions in the 75-minute encounter, wrapping up victory with a neat cross-court clip after chasing down a Youzhny drop shot.
The home crowd will be treated to a high-profile all-Spanish quarter-final between Nadal and David Ferrer, who saw off German Tommy Haas in three close sets.
The first break came in the 11th game as the fourth seed won the first set 7-5 and there was little in the match throughout as he eventually prevailed 7-5 4-6 6-4.
Also in the bottom half of the draw, sixth seed Berdych beat Kevin Anderson 7-6 (7/5) 7-5 while France's Jo-Wilfried Tsonga, seeded seventh, battled past Fernando Verdasco 4-6 6-3 6-2.
Stanislas Wawrinka had to come from a set down to beat Bulgaria's rising star Grigor Dimitrov, the shock second-round conqueror of world number one Novak Djokovic, 3-6 6-4 6-1.
In the women's draw, the top two seeds Serena Williams and Maria Sharapova both progressed to the quarter-finals in straight sets.
Williams dropped only four games against 13th seed Maria Kirilenko, breaking the Russian's serve twice in each set to win 6-3 6-1 in an hour and five minutes.
Sharapova was made to work hard in the second set against unseeded German Sabine Lisicki before eventually breaking for the second time in the set, and the sixth time in the match, to complete a 6-2 7-5 win.
Seventh seed Sara Errani also advanced, the Italian beating American Varvara Lepchenko 7-5 6-3 in a match featuring 10 breaks of serve.
Russia's Ekaterina Makarova upset 14th seed Marion Bartoli 6-3 6-2 while Kaia Kanepi beat Daniela Hantuchova 6-4 6-4.