The victory gave Nadal, unbeaten now in 22 hard court matches this year, his 10th title in 13 tournaments since returning from a seven-month injury lay-off in February.
The Spaniard, also the champion at Flushing Meadows in 2010, fell to the court in flood of tears after securing the title when Djokovic netted a forehand following three hours and 19 minutes of play.
"I never thought something like this could happen," said Nadal, who watched last year's US Open on television at home during a seven-month absence from the tour due to a knee injury. "I feel very lucky about what happened since I came back.
"Playing against Novak is a very special feeling," the 27-year-old said. "Probably no one brings my game to the level that Novak does."
Coming into the final Nadal had only lost one set, to Philipp Kohlschreiber in the fourth round, and had only been broken once, by Richard Gasquet in the last four, and for the first set-and-a-half against Djokovic nothing looked set to change as the Spaniard dominated the baseline rallies.
But the world number one, playing in his fourth consecutive US Open final, suddenly found some breathtaking tennis to take control of the second set and suggest a reoccurrence of their epic five-set battles in their last two Grand Slam meetings - the French Open semi-final earlier this year and the Australian Open final in 2012.
Nadal, however, had other ideas and battled back from an early break down in the third set before running away with proceedings in the fourth as Djokovic tired.
"He was too good," said Australian Open champion Djokovic. "He definitely deserved to win this match and this trophy.
"Obviously it's disappointing to lose a match like this. But it's an honour and privilege to be fighting for this trophy."
The French Open champion began the match in scintillating fashion and broke Djokovic in only the fourth game with a scorching inside-out forehand winner across court.
Another break followed in the seventh game, following eight consecutive points for the Spaniard before he wrapped up the set in just 42 minutes with only four unforced errors to his name.
The early stages of the second set looked set to follow much the same pattern before Djokovic suddenly found a new level of intensity and secured a rare break of the Nadal serve in the sixth game after a gut-busting 54-stroke rally which eventually ended in a netted backhand from the Spaniard.
Although Djokovic promptly gifted Nadal the break back, the 26-year-old Serb re-established his break lead in the eighth game, racing up to a decent drop shot from Nadal and flicking it away across court for a backhand winner. Djokovic served out the set without difficulty, levelling the match with a backhand winner down the line.
The third set was a keenly-contested affair with first Djokovic and then Nadal seemingly having the upper hand.
Djokovic broke early in the opening game to continue his momentum from the second set but a poor game, and possibly his worst backhand of the entire match, in the sixth allowed Nadal to break back and level the score.
The decisive ninth game was a particular highlight of the match as Nadal was forced to battle back from triple break point down, saving the third with his first ace of the match, before going to hold at the second attempt with a smash winner.
Djokovic put up a good fight to save the set but appeared to be running out of ideas as he slapped a short forehand into the net after a blocked return from Nadal before gifting the Spaniard the two-sets-to-one lead with a forehand long.
The Serb enjoyed another couple of break points in the opening game of the fourth set, but as he has done nearly all tournament, Nadal saved them both with brutal hitting from the baseline.
After Djokovic's failure to break in that opening game, the fourth set was all about Nadal as he secured breaks in the second and sixth games before wrapping up the title on the first of his two match points.
"It's all my fault," said Djokovic. "I made some unforced errors in the crucial moments with forehands and dropped the serve twice when I should not have.
"Then he started playing much, much better after that, and I obviously could not recover."
Nadal now has 13 Grand Slam wins to his name, moving him into third on the all-time list, one ahead of Australian Roy Emerson but still behind Roger Federer (17) and Pete Sampras (14).
- Sports & Recreation