Novak Djokovic defended his Wimbledon title Sunday, defeating one of the game’s greatest players, Roger Federer, in an epic five-set match that was the longest final ever in history at the All England Club.

Djokovic looked stunned after Federer shanked a forehand on the last point, sending the ball skyward.

The sets were 7-6 (5), 1-6, 7-6 (4), 4-6 and 13-12 (3). The final lasted nearly five hours, longer than any other Wimbledon final.

"Unfortunately in these kinds of matches one of the players has to lose," Djokovic said. "It's quite unreal."

Djokovic has now won Wimbledon five times..

It was also the first championship to end in a tiebreaker. Wimbledon decreed matches would end in a tiebreaker at 12 games all beginning this year to do away with never-ending matches.

SERENA WILLIAMS LOSES TO SIMONA HALEP IN WIMBLEDON WOMEN'S FINAL

In the crucial 16th game of the final set, Djokovic survived two match points with Federer serving. He then broke Federer to keep the match going on the center court.

With the victory, Djokovic became the first man in 71 years to win Wimbledon after facing match points in the final.

"Definitely tough to have those chances," Federer said.

Djokovic has done this to him before.

In the semifinals of the 2010 and 2011 U.S. Opens, Djokovic erased two match points each time before coming back to win.

"I'll try to forget," joked Federer.

"It was a great match. It was long. It had everything. I had my chances. So did he. I thought we played some great tennis. In a way, I'm very happy with my performance, as well," Federer said during the trophy ceremony. "But Novak, it's great. Congratulations, man. That was crazy. Well done."

MEGHAN MARKLE AND KATE MIDDLETON ATTEND WIMBLEDON FINAL FOR SECOND YEAR IN A ROW

Sunday’s match was their third meeting at Wimbledon. Djokovic won both of the previous matchups, in 2014 and 2015.

Federer, 37, was going for his 21st Grand Slam trophy overall Sunday, while the 32-year-old Djokovic was playing for his 16th. Had Federer won, he would have been the oldest man to win a Grand Slam title in the professional era. Rafael Nadal, who lost to Federer in the semi-finals, owns 18 Grand Slam titles.

CLICK HERE TO GET THE FOX NEWS APP

Djokovic and Federer had played each other 47 times previously with Djokovic holding a 25-22 head-to-head edge. Sunday was also their 16th showdown at a major — the most between any two men in the professional era — and Djokovic leads that count 9-6 so far.

On Saturday, Romanian player Simona Halep beat American Serena Williams in straight sets, stopping Williams from tying the record for 24 Grand Slam trophies.

Fox News' Robert Gearty and The Associated Press contributed to this report.