(CNN) -- Roger Federer dropped his serve just once during a two-hour battle with Andy Roddick at the Miami Masters, but it was enough to end the former world No. 1's 16-match winning streak.
Federer, who has already clinched three titles in 2012, boasts a strong record against world No. 34 Roddick and has beaten the American in four major finals among his record 16 grand slam crowns.
But Roddick, the U.S. Open champion in 2003, dug deep to record a 7-6 (7-4) 1-6 6-4 win -- only his third over the Swiss in 24 meetings and his second at the U.S. hard-court event.
"For me, it was obviously a tough loss," Federer told the tournament's official website. "The one service game where I got broken, he really goes for it and it all works out.
"I had my chances. I thought Andy did well to get the first, and then to put me in the situation I guess in the third. I could have been up a break early in the third, but he did well also to fight off those break points. He served really well."
Roddick, a two-time winner in Miami, set up a last-16 tie against Argentine 21st seed Juan Monaco.
"It was kind of a game of chess," said Roddick, also a former world No. 1. "I stayed back on the returns, which is something I have not done with him often early on. I think he might have been a little bit surprised by it.
"He started coming in a lot and putting the pressure on me, and it was 6-1 in the second and 0-40 early in the third. It was apparent that that wasn't going to work much longer.
"So I said, 'Well, all right. Let's kinda go over the top aggressive.' I was able to get out of that game and play that really good game to break, and then my serve held up from there."
Defending champion Novak Djokovic had no such problems, as the world No. 1 won 6-3 6-4 against fellow Serb and 27th seed Viktor Troicki to set up a clash with Frenchman Richard Gasquet.
"Generally, I feel that I have been playing well in my first two matches," the 2012 Australian Open champion said.
"I did have some ups and downs, especially in today's match, but I'm confident that I can raise the level of performance in every match."
Spanish fifth seed David Ferrer and 2009 U.S. Open winner Juan Martin del Potro will face off on Tuesday after scoring wins against French No. 30 Julien Benneteau and 23rd-ranked Croat Marin Cilic respectively.
U.S. No. 1 Mardy Fish also advanced with a straight-sets defeat of South African No. 28 Kevin Anderson. Spanish 12 seed Nicolas Almagro awaits in the next round, having beaten compatriot Fernando Verdasco 6-3 6-4.
"Almagro has been playing great this year, even on hard courts," said Fish. "He'll be a tough player."