Novak Djokovic dug deep to reach the quarter-finals of the Monte-Carlo Masters after Pablo Carreno Busta mounted a storming fightback.
Djokovic was in danger of following Andy Murray and Stan Wawrinka out of the tournament on a day of shocks in the principality, but the second seed prevailed 6-2 4-6 6-4.
The 12-time grand slam champion was made to work for his second-round victory over Gilles Simon and the spirited 13th seed Carreno Busta pushed him all the way on Thursday in a match that swung one way and then the other.
World number two Djokovic, a two-time winner of the clay-court tournament, fell away in the second set and saved two break points at 4-4 in the decider, but got the job done on Court Rainier III to set up a meeting with David Goffin.
Two double faults in the first game put Djokovic in trouble, but he saved three break points and took the upper hand after a slow start to lead 4-2 courtesy of a sumptuous backhand drop shot.
The Serb looked in the mood, piling the pressure on his opponent and duly wrapping up the opening set when the underdog sent a backhand into the tramlines.
Djokovic had won six games in a row when Carreno Busta sent a forehand long to go 2-0 down in the second set, but the Spaniard showed great character to battle his way back into the match as the favourite lost his way.
A flat Djokovic complained about the sun being in his eyes and looked distracted, while Carreno Busta shifted the momentum in his favour, winning five games in a row before levelling the contest following a tentative shot from the French Open champion.
Djokovic's aggressive approach paid off when he showed the hallmark of a champion to dig himself out of a hole at 15-40 down with the pair were locked at 4-4 in the decider and broke to finally see off Carreno Busta with a forehand volley.