The top seed and 2011 champion, playing in his 26th consecutive quarter-final at the majors, claimed his 55th match win in New York.
Djokovic, this year's Australian Open and Wimbledon champion, also enjoyed his fifth win in five meetings against Lopez and will take a staggering 13-0 career record over defending champion Marin Cilic into their Friday semi-final.
Cilic reached the semi-finals with a 6-4, 6-4, 3-6, 6-7 (3/7), 6-4 win over France's Jo-Wilfried Tsonga.
"He has a big serve. I played a bad game in the second game of the second set and it was gone.
More From This Section
"The fourth set was anyone's. He had some break points while I had to wait until the tiebreak to get a look.
"I played it well and I am happy to get through in four."
Djokovic had been pushed to four sets by Lopez's Spanish compatriot Roberto Bautista Agut in the previous round.
In front of a subdued Arthur Ashe Stadium which had thinned out after the Serena Williams-Venus Williams blockbuster, Lopez managed just five points on the Djokovic serve in the 25-minute opener and was broken twice.
But Lopez, one of four men over 30 to make the last- eight, rallied in the second set, breaking in the second game on his way to a 4-1 lead.
Djokovic saved one set point but a 10th ace gave serve- and-volleyer Lopez the set 6-3.
He then played the perfect tie-breaker in the fourth to take victory while Lopez was left to rue his 48 unforced errors in a match which finished just after 1am on Wednesday.