WIMBLEDON, England (AP) — For nearly five tight, tense and terrific hours, Novak Djokovic and Roger Federer traded the lead, playing on and on and on until an unprecedented fifth-set tiebreaker was required to settle their memorable Wimbledon final.

In the end, it was Djokovic who emerged victorious, coming back to edge Federer 7-6 (5), 1-6, 7-6 (4), 4-6, 13-12 (3) and become the first man in 71 years to take home the trophy from the All England Club after needing to erase championship points.

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

He claimed his fifth Wimbledon title and second in a row.

This triumph also earned Djokovic his 16th Grand Slam trophy overall, moving him closer to the only men ahead of him in tennis history: Federer owns 20, Rafael Nadal has 18.

“I gave it all I had,” Federer said.

He has ruled grass courts since the early 2000s; he has won Wimbledon eight times dating to 2003, and this was his record 12th appearance in the title match. But Djokovic is now 3-0 against Federer in finals at the place and 4-0 against him in five-setters anywhere.

This one was unlike any other, though.

That’s because, while it was reminiscent of Federer’s 16-14 fifth-set victory over Andy Roddick in the 2009 Wimbledon final, that score is no longer possible: The All England Club altered its rule this year to do away with never-ending matches and institute a tiebreaker at 12-all in a deciding set.

At one point during the final set Sunday, Djokovic asked chair umpire Damian Steiner whether the change called for the tiebreaker at 10-10. Later, when Djokovic held for an 11-10 lead, it was Steiner who got confused, beginning to call out the score as 11-9, before catching himself.

“I respect whatever the rule is,” Federer said when asked what he thinks of the altered setup. “So really, it is what it is, you know?”

Federer and Djokovic pushed each other to the limit in what became as much a test of focus and stamina as it was about skill.

It is destined to be discussed for years.

“I’ll try to forget,” joked Federer, who is less than a month shy of his 38th birthday and would have been the oldest man to win a Grand Slam title in the professional era.

“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.”

First, it was Federer who kept falling behind, then coming back. He twice trailed by a set even though he came quite close to winning the match in three: Federer was two points from grabbing the opening set on seven occasions but couldn’t do it; he was one point from seizing the third, but again came up short.

Then, Federer was down a break early in the crucible of the fifth. And then, after seemingly gaining the upper hand, standing a single point from winning while serving for the victory at 8-7, 40-15, he faltered.

He sent a forehand wide on the first championship point, and Djokovic produced a cross-court forehand winner on the next. Soon enough, the 32-year-old Djokovic had broken back and on they would play for another 45 minutes.

“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.

Looking at the bigger picture, there’s also this takeaway from Sunday: Nadal’s status as Federer’s principal nemesis has been well-documented and much-examined over the years — which is a small part of why Friday’s semifinal victory for Federer was fraught with meaning. But it’s now high time to discuss Djokovic’s edge over Federer.

Djokovic has won their past five meetings and holds a 26-22 advantage overall head-to-head, including 10-6 at Grand Slam tournaments and 3-1 at Wimbledon.

By the reverberating sound of things around the old arena Sunday, a vast majority of the spectators were pulling for the popular Federer. Made it seem as though he might be British, not Swiss.

While one person cried out, “We love you both!” — a fitting sentiment, given the high quality and unceasing shifts in momentum — the “Come on, Roger!” count far outnumbered the shouts for his Serbian foe.

Yes, they roared for Federer’s ace on the very first point and when he sent the final to a fifth set. They even applauded when he kicked a ball to a ball boy or when he brought his racket around his back to make meaningless contact after Djokovic served a let.

And then there were the “Awwwws.” So many “Awwwws” — pained sighs of despair accompanying a missed backhand here, a double-fault there, by their guy.

It wasn’t until the fourth set that Federer faced so much as one break point, no small accomplishment against Djokovic, considered by many to be the greatest returner of his, or perhaps any, generation. Still, even though Federer did get broken in that set, he won it to send this match to a fifth.

What already was fun to watch became completely riveting.

That’s not to say the tennis was perfect, because both men showed signs of fatigue and perhaps nerves. Federer’s mediocre approach shot provided Djokovic an opening for a backhand pass that earned a break and a 4-2 lead.

Djokovic’s double-fault in the next game helped Federer break back, and the ensuing changeover was filled with a fugue of fans’ voices chanting the first names of both.

As the newfangled tiebreaker carried the last set alone past the two-hour mark, it was Djokovic who was better. When Federer shanked a forehand off his racket frame, it was over, allowing Djokovic to renew his personal tradition of plucking some blades of Centre Court grass and chewing on them.

“We know how strong Novak is, and has been for many, many years, as well,” Federer said. “Every win, every extra win, adds to the tally.”

___

More AP tennis coverage: https://www.apnews.com/apf-Tennis and https://twitter.com/AP_Sports