Djokovic was made to work hard for his win over Andreev
World number three Novak Djokovic struggled into the last eight of the Rome Masters with a 6-3 3-6 6-3 win over Igor Andreev in round three.
The Serbian looked to be struggling physically when pegged back to one set all but found his form in the decider.
Djokovic is on course for a semi-final with world number one Roger Federer, who beat Ivo Karlovic 7-6 (7-4) 6-3.
Russian fourth seed Nikolay Davydenko crashed out after losing 4-6 6-2 7-6 to Spain's Tommy Robredo.
Djokovic suffered with illness at Monte Carlo two weeks ago and looked uncomfortable early on against Andreev.
He faces Nicolas Almagro next, after 12th seed Fernando Gonzalez pulled out of their match with a leg injury.
"I'm very relieved and satisfied to get through this one," said Djokovic. "He's one of the most difficult players to beat on this surface.
"I was trying to be aggressive and I think the patience was very crucial.
"I didn't know what to expect from my physical condition and I'm very happy.
"I'm a little bit tired but not as much in the last few weeks and recent matches."
Federer was made to work hard by his Croatian opponent, facing two break points in only his second service game.
The Swiss star, who next meets Radek Stepanek, forced five break points in game eight but big serving from Karlovic denied him then and at 6-5 when he had set-point.
Karlovic finally cracked in the tie-break when Federer produced a stunning forehand return pass and Karlovic netted a backhand.
Federer gained an early break at 2-2 in the second, hitting a forehand winner on the line, and broke again in the final game to seal his sixth victory in as many victories over Karlovic.
"It's difficult to judge against him. Ivo has an unbelievable serve, probably the best we have in the game," Federer said.
"And he comes to the net too, so there's always a lot of pressure."
Sixth-seeded Andy Roddick beat local favourite Simone Bolelli 7-6 (7-5) 6-3 and another American, number eight seed James Blake, battled past Fernando Verdasco of Spain 5-7 7-5 6-2.
"Who would have thought we would have a couple Americans making up a quarter of the draw in the quarter-finals," said Roddick, who will take on Robredo.
"I guess we landed on the moon."
Spain's Juan Carlos Ferrero failed to build on Wednesday's shock win over countryman Rafael Nadal and lost 6-4 6-3 to Switzerland's Stanislas Wawrinka.
Britain's Jamie Murray and partner Max Mirnyi lost 6-4 6-4 to American pair Mike and Bob Bryan in the second round of the doubles event.