The world number one from Spain became the first man to win five successive titles at Roland Garros to take his overall grand slam tally to 14 - three short of Roger Federer's record.
Djokovic, who was looking to become the eighth man to complete a career grand slam, made a great start but appeared to suffer from the heat and humidity after losing the second set.
The 28-year-old Nadal, who has only lost one of his 67 matches on the Paris clay, fell on his knees when Djokovic double-faulted on the first match point.
"In matches like this every moment is crucial. Playing against Novak is always a big challenge, I had lost against him the last four times," Nadal said on court.
"Sorry for him today, he deserves to win this tournament."
It was Djokovic's sixth attempt against Nadal in his spiritual home, and his sixth failure - the second in a final after the 2012 showdown.
Djokovic, one of three men to beat Nadal on clay this year, had also won four of the last eight matches he had played against the Spaniard on the slow surface.
None of them had occurred in a best-of-five match, though.
The 27-year-old Serb, who became the first person to win the opening set of a Roland Garros final against Nadal since 2006, went 40-15 up on Nadal's serve in the eighth game as the Spaniard had trouble finding his range.
Nadal saved the two break points with a forehand winner down the line and a big first serve but misfired on the third.
He had two break points in the ninth but fluffed a forehand on the first and sent another long on the second as Djokovic held to take the first set when Nadal failed to return a booming forehand.
Nadal set up a break point in the sixth game of the second set and thought he had won it with a backhand, only for umpire Pascal Maria to overrule the linesperson and award the point to Djokovic.
The Spaniard had another chance and there was no contest this time as Djokovic returned Nadal's forehand into the net, but the Serb broke straight back when his opponent's forehand sailed long.
Djokovic saved another break point in the eighth game but the momentum had shifted Nadal's way and the man from Mallorca took the set on the world number two's serve with a forehand winner.
He broke in the second game of the third set when Djokovic, who looked exhausted, netted a regulation volley.
At the following change of ends, the Serb almost fell off his chair.
Djokovic continued to fight but Nadal was always on top, wrapping up the set on Djokovic's serve when the Serb sent a forehand long.
It was a long backhand that gave Nadal a seemingly decisive break for 4-2 in the fourth set, but a rejuvenated Djokovic broke straight back before a final lapse in concentration handed Nadal the title.
"Congratulations to Rafa and his team, it is incredible to win this tournament nine times," Djokovic said.
"It was an emotional day. I have tried with all my power, my strength, my capacities but Rafa was the strongest on court.
"To my team: this trophy is not for us this year but we will try again and again."
- Sports & Recreation
- Roland Garros