Everything had been going to plan for Federer until he served a double-fault on match point at 5-4 in the second set. Two poor backhands enabled 20-year-old Almagro to level at 5-5, Federer played an uncharacteristically loose tie-break and suddenly the game's best player found himself in a see-saw deciding set against the world No 54.
Almagro, who had lost to Federer in straight sets at last year's French Open in their only previous meeting, does not have Nadal's physical presence but still hits the ball with formidable power on both flanks. Serving second in the final set, he regularly dug himself out of trouble by going for winners when some might have opted for safety first.
Federer, who sometimes had trouble keeping his feet on the slippery surface, needed four more match points before Almagro's day in the sun ended when he put a forehand into the net.
As usual, the world No 1 was coolness personified after the match. Would Almagro be a threat at the French Open? "To cause upsets maybe, but it would be far-fetched to think he could win the title." How would he describe the match? "I wouldn't call it an escape. I was up all the time. I served for the match and then I was always up in the third set. I don't think he had a break point in the third."
Federer insisted to a disbelieving questioner that he had come here simply aiming to reach the quarter-finals. "You underestimate the toughness of the Masters Series," he said. "You play seeds in the third round and you play every day if you start on the Tuesday. It's really hard, especially on the body. I haven't been playing for two weeks and other players come here with confidence. Everybody's playing well."
Federer will need to be at his best if he is to make further progress. David Nalbandian, his next opponent, moved smoothly into the semi-finals with a 6-3, 6-3 victory over Mario Ancic. He has dropped only one set this week - one more than he conceded in winning his fifth ATP title at Estoril last weekend. Moreover, the Argentinian has won six of his 10 matches against Federer, including their last meeting, in the final of the Tennis Masters Cup in Shanghai last November.
If Federer wins, it will be no surprise if Nadal is his final opponent for the third time this year. The Spanish teenager won his 51st match in succession on clay when he beat Fernando Gonzalez, 6-4, 6-3 and will equal Guillermo Vilas's 29-year-old record of 53 consecutive victories on the surface if he retains his title tomorrow. In today's semi-finals Nadal plays Frenchman Gaël Monfils, who upset Andy Roddick 6-2, 6-3.Reuse content