Novak Djokovic has been knocked out of the Madrid Masters in three sets by Grigor Dimitrov.
Both players were well matched in the first set, each being broken once before heading into a tie-break, which the Bulgarian edged 8-6.
The world number 28 looked strong early in the second, breaking the Serb to take a 4-2 advantage, but the top seed got the break back to force another tie-break and level the match.
After saving three break points at the start of the third set, Dimitrov found his rhythm again to break the world number one and take a 2-0 lead.
Djokovic struggled to attack against the 21-year-old's serve and was broken again late in the set, allowing Dimitrov to secure the third 6-3 and progress to the third round, where he will face either Santiago Giraldo or Stanislas Wawrinka.