Six-time ATP Rome Masters champion Rafael Nadal was given a fright by Ernests Gulbis before coming through an epic three set encounter, 1-6 7-5 6-4.
The Latvian world No 46, who has three career titles to his name, produced an explosive performance by hitting 59 winners but also made 50 unforced errors.
And Nadal, who has lost just 21 matches on clay in his career, used all his experience at the Foro Italico to eventually come through in two hours and 37 minutes.
Gulbis produced an almost perfect set of tennis as he raced into a 5-0 lead, but failed to become the first man to 'bagel' Nadal in an opening set on clay as the Spaniard held his serve.
Gulbis lost his serve for the first time in the match in the eighth game of the second set, but fifth-ranked Nadal failed to serve out. However, he was gifted the set when his rival netted a straightforward volley.
It took a while for Nadal to assert his authority in the decider, but he did so to move 4-2 ahead. But Gulbis, who can be gifted but erratic, immediately broke back.
However, at 5-4 the defending champion came through on his third match-point thanks to another error courtesy of the Latvian.
Nadal, who has won five titles since making his return after seven months out with a knee injury, will next face Spanish compatriot David Ferrer, who was given a walkover win when German Philipp Kohlschreiber pulled out suffering from vertigo, for a place in the semi-finals.
Roger Federer had no such problems in reaching the last eight, easing to a straight-sets victory over Frenchman Gilles Simon.
The Swiss ran out a 6-1 6-2 winner to set up a match with world number 24 Jerzy Janowicz who beat another Frenchman, the ninth-seeded Richard Gasquet, 3-6 7-6 (7/2) 6-4.
Federer needed just 23 minutes to win the first set against Simon, making use of all three of his break points and was never troubled on serve as he clinched the emphatic win in just an hour and two minutes.