It is the 16th Grand Slam title for the 32-year-old Djokovic, world No. 1.
Djokovic moved 6-3 ahead and, after the final point had to be replayed following a Hawkeye challenge, he could celebrate victory when a tired Federer framed a forehand.
Today's final was the pair's third meeting in the title match at the All England Club.
Djokovic's unusual victory snack stems all the way back to when he won his first Wimbledon title in 2011.
They have played each other 48 times already, with Djokovic holding a 26-22 head-to-head edge. There was confusion as Djokovic's first match point was replayed after a Hawkeye intervention.
At one point during the final set Sunday, Djokovic asked chair umpire Damian Steiner whether the change called for the tiebreaker at 10-10.
Djokovic, who was out-played for large parts of the match by his 37-year-old opponent, eventually prevailed 7-6 (7/5), 1-6, 7-6 (7/4), 4-6, 13-12 (7/3) in 4 hours and 57 minutes.
"I just told myself before the match, I'm going to try to switch off as much as I can from what is happening around us, and just be there, be present".
Novak Djokovic and Roger Federer battled in a Wimbledon final for the ages. Federer had a chance to win it with two championship points but then netted a weak forehand to level it again at 8-8. It could have gone easily his way. "Novak, congratulations, man, that was insane", Federer said on court, disguising the heartache he must have felt.
It was a display of stunning mental fortitude by Djokovic.
Novak Djokovic outlasted Roger Federer on Sunday in what was perhaps the greatest Wimbledon Men's final ever. "I wish I had more, but I don't".
A forehand mistake cost Federer his first match point and then he watched aghast as Djokovic whipped a forehand victor across him as he closed in on the net.
"I'm just obviously thrilled and overjoyed with emotions to be sitting here in front of you as a victor".
Just as in the second set Federer stormed two breaks clear in the fourth and although Djokovic finally broke his serve after almost three hours on court, the Swiss held to love at 5-4 to send the match into the tumultuous decider.
Djokovic is by far the most consistent of the "Big Three" at the Slams. The holy court of tennis, resonated with 'Come On Roger!' cheers and World Number one tennis player talked about his course of action against those clamours.
- Telford Conservative chairwoman backing Boris Johnson as PM
- Leclerc fastest and Vettel second as Ferrari set pace
- Man United Standing Firm As Pogba In Contention For Big Squad Role
- Williamson hails NZ after World Cup stunner
- Rohit Sharma stands firm on top despite India's exit from World Cup
- World, Meet the Samsung Galaxy Note 10
- India set to launch Moon rover and orbiter
- Nintendo Introducing Portable "Switch Lite"
- President Trump is not a fan of Bitcoin or other cryptos
- Antoine Griezmann: FC Barcelona sign French striker for €120 million