The world number one, who accepted a late wildcard to compete at the ATP 250 tournament ahead of defending his French Open title, got himself out of a hole as he saved four set points from 0-40 down in the 10th game before breaking his opponent for a 6-5 lead. He then served out the first set.
The 37-year-old Serb kept the momentum going as he broke serve three times in the second set, lasting just 25 minutes, to prevail over the world number 27.
"Great win. I thought that the first set could have gone his way easily because I think he was the better player for most of the first set," said Djokovic, who has been stuck on 98 singles titles since triumphing at last year's ATP Finals.
"He had three set points. I was facing 0-40 at 5-4 for him, so we could have been having a completely different direction of the match if he converted those set points.
"I was lucky to find some really good serves and from that moment onwards really played some good solid tennis. The second set was really good. I want to thank everybody for the support on this cold day."
The 24-time Grand Slam winner will face Czech Tomas Machac in Friday's semi-finals.