Roger Federer was given a real scare before beating Milos Raonic to reach the third round of the Madrid Open.
Federer, playing his first match after five weeks off, had to dig deep to beat the in-form Canadian 4-6 7-5 7-6 (7-4).
Raonic, who beat Andy Murray in Barcelona last week, showed some superb touches but found the Swiss star just too good.
Defending champion Petra Kvitova lost 6-4 6-3 in the women's event to Czech Republic compatriot Lucie Hradecka.
The third seed struggled with her serve and was broken five times by Hradecka, who will face Ekaterina Makarova in the third round.
Federer, who had taken a break after losing to Andy Roddick in Miami in March, had to use all his experience to narrowly avoid his earliest tournament exit in two years.
The last time the 16-time Grand Slam champion was eliminated in the second round was the 2010 Rome Masters, where he lost to Ernests Gulbis.
Raonic, the world number 23, had seized on his solitary break point chance to take the first set, but Federer responded by breaking in the 12th game of the second to force the decider. After it went with serve all the way, Federer edged through the tie-break to victory.
Elsewhere, world number two Rafael Nadal criticised the blue clay courts after winning his first match.
The Spaniard beat Nikolay Davydenko 6-2 6-2, breaking his Russian opponent four times to advance to the third round.
But he was less than happy with the court, which had been changed from red to blue for the tournament, describing the surface as soft and slippery.
"The [blue] court...doesn't make you feel comfortable. It's difficult, hard to attack and come back to defend. You just have to try and adapt," said Nadal, who still managed six aces and 19 winners.
"I played much better than I expect."
Nadal will next meet Fernando Verdasco, who beat Alejandro Falla of Colombia 6-7 (4-7) 6-4 6-4.