Djokovic, thus, wins three of the year's four majors for the second time in five years -- something Federer did in his prime three times in four years.
After a three-hour rain delay turned this into a classic, rollicking US Open night match, the No. 1 seed pushed his major total to 10, tying him with Bill Tilden for seventh all-time, only one behind Bjorn Borg and Rod Laver.
It can be argued that Djokovic -- 27-1 in Grand Slam singles matches this year, one better than Serena Williams' 26-1 -- has had a more successful season.
To put his year in context, consider that Djokovic is only the third man in the Open era to reach all four major finals, joining Federer and Laver.
"It's been an incredible season, next to the 2011 season, the best of my life," Djokovic said in his on-court interview. "I'm enjoying it more as a husband and a father, and this makes it more sweeter.
"It's a quite incredible evening for me."
Previously, the 28-year-old Serb had lost four of five US Open finals. This 3-hour, 20-minute match was one of Djokovic's finest. Afterward, amid a rousing standing ovation, he calmly turned to his box and touched his heart.
It was not the result sentimental fans of Federer -- and the majority of the sellout crowd on Arthur Ashe Stadium -- hoped for. The 34-year-old Federer, who hasn't won a Grand Slam in more than three years, failed to extend his all-time leading total to 18 major titles.
There were palpable moments in the third set, however, when it seemed quite possible, but Federer could never quite break Djokovic's serve in a big spot.
For the match, Federer accumulated an impressive 23 break opportunities, but could manage it only four times.
Put another way, Djokovic saved 19 of 23 break points against him. And to think that early in his career he was criticized for not being mentally tough.
Federer was bidding to become the oldest Grand Slam champion since 35-year-old Andres Gimeno won the 1972 French Open.
"Had a wonderful last two weeks," Federer said in his on-court interview. "Very pleased where my game's at. Being back in the finals is where you want to be. I enjoyed it. Congratulations, Novak, on another great win."
Arguably, based on the quality and quantity of their encounters, this is the best rivalry in all of tennis. The head-to-head record is now, appropriately, deadlocked at 21-21.
"Just an incredible record and everything he has achieved," Djokovic said of Federer. "Coming out, knowing you're playing the greatest player in the history of the game adds a little more pressure.
"Today, I was serving at 5-2 in the fourth set and Roger showed why he's a champion. I was forced to come up with some big serves. Obviously, it was a big relief when I saw the forehand return going out."
After three hours in the locker room waiting for the weather to clear, both players took turns looking rattled beneath Eva Asderaki-Moore of Greece, the first woman to be the chair umpire for a US Open men's final.
Federer looked tentative, spraying forehands, and needing seven minutes (and saving three break points) to escape with the very first game.
Approaching net in the fourth game, Djokovic went down hard, slipping on what appeared to be a damp spot as he tried to cut to his right. A trainer came out two games later to clean up the scuff marks on his arm and hand.
Djokovic, though, applied more pressure to Federer's serve and extracted the first break of the match with a backhand pass to take a 4-3 lead and, eventually, the set.
The second set was splendid stuff. Djokovic, serving at 4-5, held off Federer in a 14-minute game that saw him save two set points. He actually saved a third, at 5-6, but Federer closed the deal with a massive backhand that Djokovic couldn't come up with.
In the third and fourth games of the third set, the two traded breaks.
And then Federer finally gave in serving at 4-all. His high-risk game proved fatal with a forehand that was ripped long and a backhand, hit while moving forward, that was sprayed wide.
That gave Djokovic the opportunity to serve for the third set, which he did -- after saving two more break points.
Federer, who ran more than twice as far as he did on average in his first six matches here, began to visibly tire. When Djokovic broke him in the first game of the fourth set even the pro-Federer crowd seemed to lose its energy.
When he concluded his on-court interview, Federer did not -- as Flavia Pennetta did following her triumph in the women's final -- announce his retirement.
"Last thing," he said. "I'll see you guys next year."
Federer's coach, Stefan Edberg, figures an 18th major title is still not out of reach, even though no one Federer's age has won the US Open since 1970.
"You still cannot count him out," Edberg said. "If he keeps playing at this level, he'll get another shot."
Djokovic, speaking in the postmatch news conference, sounded as if he agreed, saying about Federer: "He's just not going away."
Rain began falling about 10 minutes before they were supposed to head out from the locker room, and the start of the match was delayed until after 7 p.m. ET. But it won't happen again: The U.S. Tennis Association is in the midst of constructing a retractable roof expected to be ready for next year's tournament.
If there were many folks in favor of Djokovic in the 23,771-capacity arena, they were tough to hear. Instead -- and make no mistake, Djokovic noticed -- a vast majority were on Federer's side, even applauding faults by Djokovic, considered poor tennis etiquette. Over and over, chair umpire Eva Asderaki-Moore, the first woman to officiate a US Open men's singles final, held up a hand the way a school teacher might and asked for quiet.
"Was it louder than ever? Maybe," Federer said. "It was unreal."
Information from The Associated Press was used in this report.