Novak Djokovic was made to work for his place in an 11th Internazionali d'Italia semi-final as he overcame world number 91 Dominik Koepfer 6-3 4-6 6-3 in Rome.
Djokovic's embarrassing US Open default remains the only blemish on a record of 29 wins from 30 matches in 2020.
But he did not have things all his own way against an opponent playing his first main draw at a Masters 1000 event, wirth Djokovic having already been taken to three sets by fellow Serbian Filip Krajinovic on Friday.
The world number one targeted Koepfer's backhand as he raced into a 4-0 lead, only for the 26-year-old German to claw back both breaks.
That set the tone for an up-and-down affair, with Djokovic reasserting himself with the forehand to deny Koepfer another game in the first set.
Djokovic had an early advantage in the second but Koepfer levelled up at 3-3, passing his illustrious foe with an eye-catching crosscourt backhand, and the underdog's fourth break of the contest set up a decider.
The relentless pace took a toll on Koepfer as he coughed up a love service game at 1-1 and Djokovic powered home from that point, landing a backhand drop volley to convert his second match point.