The six-time Grand Slam champion, who won the 2011 US Open title, will next face Russian 21st seed Mikhail Youzhny, a two-time US Open semi-finalist who ousted Australia's Lleyton Hewitt in five sets, for a berth in the last four.
"I definitely played one of the better matches that I've played in my life here at Arthur Ashe," Djokovic said. "It was 3-all in the first set and then I managed to get the right advantage and I played flawless tennis."
Djokovic won the first 25 points on his serve in the match, won the final 15 games of the match and faced his only break point in the last game on the way to his 18th consecutive Grand Slam quarter-final appearance.
"I had everything working, every part of my game," Djokovic said. "This is great encouragement going into the next round."
Djokovic, seeking his fourth consecutive trip to the US Open final, said that he had never dominated anyone so completely with his serve as he did in overwhelming Granollers at the start of the match.
"This is probably the first time I've experienced something like that," Djokovic said. "I can't say I have one of the strongest serves on the tour but I served pretty well."
It was the first time Granollers, who has never reached a Grand Slam quarter-final, had played against a player ranked number one in the world.
Djokovic did not mind Youzhny going the distance with Hewitt either, but made it clear he will not be overconfident because he was able to leave the court after comparatively barely breaking a sweat.
"They played five sets and it was a long match," Djokovic said. "They are both quality players. It's the quarter-finals of a Grand Slam and I've got to be ready for it."
Djokovic, 26, has not dropped a set on the New York hardcourts as he booked a date in the US Open last eight for the seventh year in a row.
In his other Grand Slams this year, Djokovic captured his fourth career Australian Open title, lost to Britain's Andy Murray in the Wimbledon final and fell to eventual champion Rafael Nadal in a French Open semi-final.