
Federer's record dropped to 15-2 against the American who had not beaten him since summer 2003.
Roddick stunned the top seed to reach a semi-final against Russian Nikolay Davydenko, who beat Serb Janko Tipsarevic 6-2, 6-1.
Roddick relied on 17 aces as he upset the odds against the 12-time Grand Slam champion who has yet to win a title this season.
"That's what you wake up for, that's what you go to the practise court for," said Roddick. "Those 10, 15 seconds after a big win probably make up for a lot of bad days."
The former number one could not hide his delight at the surprise victory. "I figure I was due," said Roddick. "He hadn't missed a ball in a crucial moment for about six years against me. "The law of statistics had to come my way eventually."
Roddick won the opening set in a tiebreaker, with Federer then levelling at a set apiece.
In the third, Roddick's never-say-die fight paid dividends with a break for 5-3 as Federer stood 0-40 and produced a long-sought victory moments later.
Federer's win streak against Roddick was stopped at 11 straight, identical to his run over Lleyton Hewitt and Davydenko.
"It's a tough way to finish the match, no doubt," said Switzerland's 12-time Grand Slam champion. "I've been on a good run on my serve this week.
"To end it this way it's sort of disappointing, but what are you going to do? It's over now."
Roddick's run of form now includes the Miami semis to back up his title in Dubai a month ago where he beat Rafael Nadal and Novak Djokovic.
"It's nice to build on Dubai. To have wins over one, two and three in the world early in the season is a good thing. It's probably what's been missing the last two, three years, so it is encouraging."
Serena Williams buried back problems with repeated on-court treatment, then went to work to overhaul Svetlana Kuznetsova 3-6, 7-5, 6-3 and reach her sixth women's final.
Florida-based eighth seed Williams, who owns five titles at her "home" event, spent nearly three hours in the fightback which took her record at the tournament to 46-5, second only to Steffi Graf (59-6) on the all-time list.
Williams denied Kuznetsova the honour of becoming the seventh player to beat both Williams sisters in the same event after the Russian put out Venus in the quarter-finals.
Williams ended dead-level with 45 each of winners and unforced errors, breaking on five of her 16 chances.
"I was making so many errors compared to my quarter-final," said the American. "Sveta played a totally different game than I was expecting. That threw me off, but once I found my rhythm I thought I could win."
Williams will play for the title on Saturday against Serbian fourth seed Jelena Jankovic, who hammered Russian Vera Zvonareva 6-1, 6-4.
Kuznetsova was not displeased with her showing.
"I didn't think she dictated all of the time, it was equal. She had more winners because of her (13) aces," she said.
"You have to play your top level and take the right decision. I was not good when I was on top."
Williams called for the trainer as she trailed 3-1, receiving a time-out for a back massage as Kuznetsova buried her head in an iced towel on a steamy day.
"My back got better after I saw the trainer," said Williams. "Each time she came out it got better. It must have somehow got stuck and that just came out of nowhere."
Williams never found rhythm as she concentrated more on her pain than her game, dropped to 5-2 as Kuznetsova fired her third ace of the set.
The Russian claimed the opener in just under an hour, dropped the third but squeezed through in the third.
"I did everything right but I had mistakes in the important moments," said 2004 US Open winner Kuznetsova. "Physically, I was fine."
"I've had a long month here, I played the finals at Indian Wells, and played singles and doubles here," she added. "Serena may have been fresher, but we stayed equal."
By Bill Scott, dpa