Murray was up 6-2, 1-0 when Spaniard Almagro, unseeded for the tournament, withdrew from the match having called for treatment at the end of the first set.
The Scot goes on to face sixth-seed Robin Soderling who overcame Jo-Wilfried Tsonga in straight sets to book his quarter final place.
Meanwhile, Ivan Ljubicic knocked Novak Djokovic out of the tournament with his 7-5, 6-3 win. Rafael Nadal however saw off John Isner 7-5, 3-6, 6-3 to remain in contention for the title.
Nadal, twice winner of the tournament and Murray’s victor in last year’s final, will face Tomas Berdych.