Despite hitting 38 unforced errors in a back-and forth match, the top-ranked Serb won the first big clay-court tournament of the season with a 7-5, 4-6, 6-3 win over Tomas Berdych in the final of the Monte Carlo Masters.
It was Djokovic's second triumph in three years in the principality, where he lives with his wife and kid, and his 11th straight win in a final.
"In the end, I'm sitting here with this trophy that is very special to me, of course," the Australian Open champion said. "This is what matters. Sometimes winning ugly is necessary. It's been a remarkable start of the season for me."
Djokovic, who has lost only two matches in 2015, became the first player in tennis history to win the first three Masters tournament of the year after completing the Indian Wells-Miami sweep this spring.
"The fact that now I won three Masters in a row, that nobody ever has done that ... that has given me, even this week, more motivation," he said.
With his 23rd Masters title, Djokovic extended his winning streak to 17 matches, including a straight-set win over clay specialist Rafael Nadal in the semifinals on Saturday.
Djokovic's next big goal is to win the French Open, the only major tournament missing from his collection. Although he tamed Nadal for the second time in three years at the Country Club this week, the nine-time French Open champion stopped him at Roland Garros over the past three years.
"I think the most important period of the year is coming up right now," Djokovic said. "Obviously Roland Garros and Wimbledon are the priority. That's where I want to perform my best. But we'll take it step by step and see how far I can go."
In windy and humid conditions, both players struggled with their serve and made several unforced errors in a final that lacked rhythm and was suspended by rain.
The sixth-seeded Berdych put Djokovic on the back foot in the early stages with his powerful groundstrokes and forced the Serb into a deciding set for the first time this week but was ultimately made to pay for his erratic display.
"There have been just a couple of points that didn't go the way that I wanted," Berdych said. "Otherwise I think I've been pushing him quite hard. I had enough chances to make this match happen on my way and I could be the one with the trophy today."
Chasing a second Masters title 10 years after his breakthrough at the Paris Masters, Berdych raced into a 2-0 lead, dropping just two points on the way.
But Berdych could not keep hitting with such accuracy for long, allowing Djokovic to break back in the sixth game when he made three mistakes on his forehand.
The Czech dropped his serve again to trail 5-3 but Djokovic could not serve out the set. The Serb raised his level in the 12th game, claiming the set on his third opportunity.
Berdych failed to seize his chance in the fifth game of the second set when Djokovic double-faulted to find himself 0-40 down. The Serb kept his head cool and won five consecutive points to move up 3-2 before the match was suspended for 70 minutes.
The rain delay had a positive impact on Berdych. He fended off a break point after a long rally punctuated by a smashed winner and was rewarded with a break in the seventh game as he pushed Djokovic into a flow of mistakes with a series of deep returns.
But the momentum swung again toward Djokovic as Berdych made five unforced errors in the first two games of the decider and dropped his serve for the fourth time.
Djokovic broke again for a 4-0 lead, but the eight-time Grand Slam champion failed to hold his serve in the next game.
He overcame another break point with a kicked second serve to move up 5-2 and raised his arms in triumph as he returned to his chair.
The Serb sealed the win on his second match point when his opponent sent a return long.
"I thought I won this match with my heart and with battle," Djokovic said. "That's how I feel like I won it."