Once seemingly invincible, Federer was beaten for the sixth time this year. The top-ranked Swiss player lost only nine matches in all of 2007. He piled up a string of losses at the beginning of this year when he was battling mononucleosis.
Stepanek advanced to the semifinals against the winner of the night match between Australian Open winner Novak Djokovic and Spanish clay-court specialist Nicolas Almagro.
The Rome Masters is a clay-court tuneup for the French Open, which begins May 25. Roland Garros is the only Grand Slam that Federer has not won. He also has never won a title in Rome. Last year at the Foro Italico, Federer was upset in the third round by Italian wild-card entrant Filippo Volandri.
Federer's elimination comes two days after three-time defending champion Rafael Nadal was beaten by Juan Carlos Ferrero. Nadal said he was not at his best because of a foot blister.
In the first set tiebreaker, Stepanek took control with a volley to go up 6-4, then served an ace on his first set point. Federer surrendered a 5-2 lead in the second-set tiebreaker, and then wasted a set point at 6-5 on Stepanek's serve. Stepanek converted his second match point with a first serve that Federer couldn't return.
"Usually when I have a lead I don't let it go, so it's quite disappointing," Federer said. "I played so poorly on the big points."
After his illness, Federer snapped back by winning the Estoril Open last month for his first title of 2008. He also reached the final of the Monte Carlo Masters in his last outing, losing to Nadal.
Federer pronounced himself fully fit at the beginning of this tournament, and his problem Friday didn't appear to be physical.
At one stretch in the first set, Federer won four straight service games without losing a point. Still, Stepanek kept up the pressure by serve-and-volleying and winning 25 of 41 points at the net. Stepanek served eight aces to Federer's seven.