Nadal, who is bidding to clinch his record eighth title in Rome, was leading 3-0 when Almagro bent over and grasped his left knee with less than half an hour played.
The Spanish maestro, who has won consecutive clay-court tournaments in Monte Carlo, Barcelona and Madrid, has now extended his winning streak to 16 matches.
Nadal will now lock horns with either the Czech Republic's Jiri Vesely or American Jack Sock for a place in quarter-finals.
In another men's singles clash, seventh-seeded Kei Nishikori also booked his place in the last -16 after registering a 7-5, 6-2 win over Spain's David Ferrer.
Throughout his second-round clash ,Nishikori showed no lingering pain from the right wrist injury that prompted him to withdraw from the quarterfinals in Madrid last week.
He will now play against either Britain's Kyle Edmund or Argentine Juan Martin del Potro in the pre-quarterfinal clash.(ANI)