The fourth seed looked to be heading for the exit when, having been dominated by some brilliant play from the 10th seed for the first two sets, he faced Almagro serving for the match at 5-4 in the third.
It is not for nothing that Ferrer is known as one of the best fighters in tennis, however, and he hustled along the baseline to claw his way back into the contest and take the third set on Rod Laver Arena.
Twice more Almagro had chances to serve out for victory but he blew them both and Ferrer, who had won all 12 of their previous meetings, emerged a 4-6 4-6 7-5 7-6 6-2 winner after three hours and 44 minutes on Rod Laver Arena.
"It was a miracle I won this match," said Ferrer, who will face Novak Djokovic in the last four.
"I tried to fight and do my best (but) next round... I need to play my best tennis, better than today. Now I will need to rest but I have a day and a half."
Almagro contributed to his own downfall by stuttering when he had victory within his sights and his body let him down in the last two sets when he was hindered by a leg injury.
"I think I played my best tennis today but it wasn't good enough to beat David," he said.
"I don't want think that it's a mentality problem. If I had a mentality problem, I think I wouldn't have won the first two sets."
Ferrer, 30, has lost all four of his previous Grand Slam semi-finals, including defeats to world number one Djokovic at the US Open in 2007 and last year.
- Sports & Recreation