The 30-year-old Serb began slowly before taking control and then snuffed out a Gulbis counter-attack in the third set to set up a clash with Frenchman Adrian Mannarino.
Djokovic, seeded two, looked fired up throughout the contest, telling the umpire to "focus" early on after some close line calls and then bellowing at himself after winning two points in the third-set tiebreak.
"I'm delighted, I raised my level of tennis today compared to the first two rounds," Djokovic, who has reached the second week for the 10th time, said.
"This was the most focussed I've been on the court for the last couple of weeks."
Djokovic trailed 4-2 in the first set as former top-10 player Gulbis, now down at 589 in the rankings having had his career interrupted by injuries, began impressively.
But once Djokovic broke back thanks to a double fault he took command and was relatively untroubled, although he did have to raise his game in the third set as Gulbis went for broke.