Federer suffers early Rome exit
Federer lost 7-6 (7-4) 7-6 (9-7), his sixth defeat of an inconsistent season.
Third seed Novak Djokovic qualified for the semi-finals after his Spanish opponent, Nicolas Almagro, retired with a wrist problem.
Stanislas Wawrinka beat James Blake to reach his first Masters semi-final, where he will play Andy Roddick.
Wawrinka followed up wins over Andy Murray and Juan Carlos Ferrero with a 6-7 (5-7) 7-6 (7-5) 6-1 defeat of Blake.
The Swiss number two, who made the last four in Barcelona last week, will face Roddick after the American beat Tommy Robredo 6-3 4-6 7-6.
Australian Open champion Djokovic cantered through the first set 6-1 against Almagro and broke the Spaniard in the first game of the second, prompting him to throw in the towel.
But the main focus of attention was on the latest defeat for Federer, who had won four of his previous five meetings with Stepanek.
With the French Open two weeks away, the defeat is a blow to Federer's hopes of claiming the only Grand Slam title to elude him.