The world No 1 won 6-4 5-7 6-4 6-4 in New York, and will end the year with three of the four tennis majors.
Novak Djokovic, 28, held his nerve in front of a heavily pro-Federer crowd at Flushing Meadows.
Roger Federer, 34, had been hoping to win his 18th major title and first for three years.
In a raucous night session on Arthur Ashe Stadium, after the start of play was delayed by more than three hours because of rain, the Swiss looked to have a real chance in the third set.
However, Novak Djokovic broke the Federer serve six times and saved 19 of 23 break points as he battled his way to a 27th win in 28 Grand Slam matches this year.
Novak Djokovic took another step towards joining the very best in history with a 10th major title, moving him within one of Bjorn Borg and Rod Laver in the all-time list.
Defeat by Stan Wawrinka in the French Open final in June means Novak Djokovic was just one win short of completing the first calendar Grand Slam in men’s tennis since Laver in 1969.
“It’s been an incredible season, next to 2011 the best of my life,” said Novak Djokovic.
He won three Grand Slam titles four years ago.
“I’m enjoying this year more than I did any previous one because I’m a husband and a father, and that makes it sweeter.”
Five-time champion Roger Federer was playing his first US Open final since 2009, and drew one of the loudest cheers of the night when he told the crowd: “I’ll see you guys next year.”
Roger Federer said it was “always tough” facing Novak Djokovic, adding: “I think we both walk away from it knowing more about our games and more about each other.
“I’m pleased with where my game is at.”
The US House Ethics Committee has voted to release its report on former Republican Representative…
ABC News has agreed to pay $15 million to President-elect Donald Trump to settle a…
South Korea’s parliament has voted to impeach President Yoon Suk Yeol over his failed attempt…
Israeli war planes have carried out more than 100 air strikes in Syria on December…
President-elect Donald Trump has threatened to impose 100% tariffs on the BRICS countries if they…
Syrian troops have withdrawn from the city of Aleppo following an offensive by rebels opposed…