The victory gave Djokovic three of the year’s four grand slam titles with a loss to Stan Wawrinka in the French Open final his only blemish.
It was the 10th career major for Djokovic but only his second U.S. Open.
The 28-year-old Serb had known more frustration than success on the Flushing Meadows hardcourts having previously reached the final five times and lifting the trophy just once in 2011.
Federer and Djokovic finally took to the court after a three-hour rain delay and were slow to find their rhythm and footing, particularly the top-seeded Serb, who crashed to the surface in the opening set badly scraping his arm and leg.
But the unflappable Djokovic quickly regained his composure and footing.
Federer, broken just twice the entire tournament, was living dangerously from the start by facing three break points in the opening game but managing to save all three.
The Swiss, however, could not fight off another three break chances on his next service game as Djokovic made the breakthrough to go up 2-1.
Federer broke back immediately but the Serb would quickly regain the advantage with yet another break to move ahead 4-3 then held serve to take the opening set from a shaky Federer.
The second set was a test of wills as Federer, with the crowd squarely in his corner, went toe-to-toe with a defiant Djokovic, the tug-of-war highlighted by a tense 15-minute 10th game with that Djokovic held to level at 5-5.
But it was Federer ending the set with a big fist pump after breaking Djokovic with a stinging crosscourt winner that brought to the capacity crowd to its feet.
The effort, however, appeared to take something out of Federer as Djokovic, sensing his chance, claimed the crucial break at 5-4 to take control.
Djokovic kept up the pressure with a break to open the fourth and then again to go up 5-2 to put the U.S. Open within his grasp.
But Federer would not go down without a fight, digging into his reserves the Swiss would break and hold serve to cut the deficit to 5-4 and put the crowd in full roar.
With Djokovic again serving for the match, Federer would get three more break chances but this time the Serb would not falter and clinched the title when Federer’s return sailed long.