Almagro served for a place in the semi-finals on three occasions on Rod Laver Arena, but the resolute 30-year-old battled back for a 4-6 4-6 7-5 7-6 6-2 triumph in three hours and 44 minutes.
Ferrer offered some comfort to his defeated countryman, telling him that he has also suffered from nerves in closing out matches in the past.
"It was a miracle," said Ferrer in his courtside interview.
"Nicolas had a lot of chances to win the match and I tried to fight every point That is my game.
"I know that players get nervous on the big points because that happens to me to."