It was difficult to predict the battle which was to come for the world number one as he made an impressive start to the last-eight clash by breaking the Spaniard twice in the opening four games to take a commanding lead in the first set.
Lopez appeared to be stunned by Djokovic's play early in the match and the opener was wrapped up in just 25 minutes.
An early finish looked to be almost inevitable after the dominant display in the first set, but Lopez responded superbly to put the pressure on the Serbian to force a couple of errors which allowed him to break to 2-0.
Despite facing break point while serving for the set, the improvement continued from the 18th seed as he deservedly pulled level by converting set point at the second attempt with an ace.
However, the momentum shifted quickly once again as Djokovic held to love at the start of the third set, before a double fault handed him a break after he had missed three chances to take the lead once again.
Djokovic was forced to save two break points in the seventh game, and his resilience was rewarded as one break proved to be enough to edge him ahead of the left-hander.
Despite struggling to keep his first-serve percentage high in the fourth set, Lopez refused to back down from the challenge but his progress continued to be halted by Djokovic, who saved two more break points in the sixth game.
For much of the night it was Lopez's game at the net which caused problems for the 2011 champion, and he went to the tactic more often as the fourth set progressed to keep the pressure on.
With the set at 6-6, a tie-break was needed to separate the pair, and it was Djokovic who got off to a better start as he broke Lopez to take a 3-1 lead.
From then on, it was plain sailing for the world number one as he broke twice more to set up a semi-final showdown against defending champion Marin Cilic.