The fifth-set tiebreaker was also the first in any men's final at the four Grand Slams.
The 37-year-old Swiss legend rued the "missed opportunity" when he held the match points on his serve in the 16th game of the decider but ended up losing 7-6 (7/5), 1-6, 7-6 (7/4), 4-6, 13-12 (7/3).
Federer was the better player for all of the first four sets, with Djokovic's game strangely off colour apart from his serve, but played two poor tie-breaks either side of a set that his opponent barely turned up for.
Djokovic leads their head-to-head series 25-22, including 9-6 at Grand Slam tournaments.
Echoes of 2008 reverberated around the All England Club as Federer and Nadal wound back the clock in their much-anticipated first Wimbledon match-up in 11 years.
While the match will be remembered by many for its thrills, Federer said: "I will try to forget".
"It's the same like going into a Rafa match: I think the moment you've played somebody, probably, more than 15 times - especially in recent years, also, a few times - there's not that much more left out there". Still, even though Federer did get broken in that set, he won it to send this match to a fifth.
He sent a forehand wide on the first championship point, and Djokovic produced a cross-court forehand victor on the next.
The world number one was fortunate to win the opener and then collapsed completely in the second, but he was typically resilient in edging another tie-break in the third set to lead 2-1 without creating a single break point.
"It's quite unreal to be down two match points and come back and win".
Federer, who agonisingly saw his bid of becoming the oldest ever Grand Slam champion, as well as winning a ninth title slip from his fingers, joked at first about being part of another epic final. You have to compliment both players.
As Djokovic chewed on a piece of Centre Court turf, having just claimed his maiden Wimbledon title by defeating Nadal, no one in the stands would have been left in any doubt as to who was the best player in the world. Just like in the first two tie breaks, Novak had the edge after an early mini-break and grabbed the tie break 7-3 to seal the deal and write history books.
Federer's four children were in his courtside box for the presentation as the Swiss collected a fourth runners-up trophy.