(CNN) -- Experience eventually overcame youthful promise at the Indian Wells Masters on Tuesday, as tennis legend Roger Federer battled to a third-round win over rising star Milos Raonic.
Raonic has already won two titles this season, and was the ATP Tour's newcomer of the year for 2011.
The 21-year-old Canadian, ranked 27th in the world, made a bright star to his clash with the former world No. 1 by clinching a first-set tie break.
But Federer, who has won a record 16 grand slam titles since turning pro in 1998, showed composure to regroup and triumph 6-7 (4-7) 6-2 6-4, setting up a last -16 clash with Brazil's world No. 50 Thomaz Belluci.
"I guess my experience helped me to stay calm and just weather the storm," the 30-year-old third seed told the tournament's official website.
"Maybe if I was younger I'd be more panicky about him hitting aces left and right and making me feel uncomfortable.
"I have been there so many times before against some of the all-time great servers that it was obviously not going to happen tonight. I just hoped to stay calm."
Raonic, seeded 23rd for the U.S. hard-court event, was pleased with his overall performance, but rued his lack of experience.
"I think I hit the ball well," he said. "I just was picking the wrong shot, and this is what makes the difference, but with experience hopefully I catch on to that."
Federer's longtime rival Rafael Nadal strolled into the fourth round with a 6-1 6-4 success against fellow Spaniard Marcel Granollers.
The second seed, runner-up here last year, will face Ukrainian 21st seed Alexandr Dolgopolov in the last 16 as he heads towards a semifinal showdown with Federer.
Nadal's fifth-seeded compatriot David Ferrer is out following a shock 6-4 6-3 defeat to Uzbekistan's 51st-ranked Denis Istomin.
Istomin earned a clash with Argentina's 2009 U.S. Open champion Juan Martin del Potro, who maintained his quest for a second title of 2012 by beating Spanish 19th seed Fernando Verdasco.
Sixth seed Jo-Wilfried Tsonga will meet former world No. 3 David Nalbandian of Argentina after beating Czech No. 28 Radek Stepanek.
In the women's draw, Serbia's Ana Ivanovic booked a place in the quarterfinals by winning the battle of the former world No. 1s against recently displaced Caroline Wozniacki.
Ivanovic, who occupied top spot after winning the French Open in 2008 but is now ranked 16th, recorded a 6-3 6-2 against the Danish fourth seed -- who lost her No. 1 ranking following Victoria Azarenka's triumph at January's Australian Open.
"I didn't do much wrong today besides the first few games on my serve," Ivanovic, 24, told the WTA's website.
"I'm really pleased the way I was aggressive, and how I just stayed in the match and played point by point. I did everything I should have done today."
Seventh seed Marion Bartoli awaits Ivanovic in the last eight, following the Frenchwoman's win over Czech No. 23 Lucie Safarova.
The top two seeds remain on track for a final showdown after both Azarenka and three-time grand slam champion Maria Sharapova won, against Germany's Julia Gorges and Italian Roberta Vinci respectively.
Next up for Belarus' Azarenka is Polish fifth seed Agnieszka Radwanska, who benefited from the retirement of American wildcard Jamie Hampton due to cramps in the third and deciding set of their match.
Russian No. 2 Sharapova will play 20th-seeded compatriot Maria Kirilenko, while the remaining quarterfinal tie pits China's French Open champion Li Na against German No. 18 Angelique Kerber.