LONDON—Novak Djokovic knew all along that his game was good enough to win more Grand Slam titles. It was his mind that was the problem.

And so after failing to convert a match point against Roger Federer in the fourth set of the Wimbledon final, and after losing five games in a row to get pushed to a fifth set, Djokovic left the court for a bathroom break so he could give himself a pep talk.

What Djokovic needed right then, he explained Monday, was "positive encouragement," a way to confront the "disappointment that is bringing with itself the fear and the doubt and all these different demons inside."

It worked.

"I managed to have my convictions stronger than my doubts in this moment," he said, "and managed to push myself the very last step and to win the trophy."

Djokovic's 6-7 (7), 6-4, 7-6 (4), 5-7, 6-4 victory over Federer on Sunday earned the 27-year-old Serb his second Wimbledon championship and his seventh major title overall, matching the career totals of John McEnroe and Mats Wilander. It pushed Djokovic back to No. 1 in the rankings after a ninth-month absence.

What it also did, more importantly for the future, was restore his self-belief.

Entering Sunday, Djokovic had lost three major finals in a row, and five of his last six. That included a defeat against Andy Murray at Wimbledon a year ago, and a defeat against Rafael Nadal at the French Open a month ago.

In what is supposed to be the prime of his career, Djokovic went 1½ years without winning a Grand Slam tournament, the sort of drought that makes it hard to gain on the guys whose company he wants to keep: 17-time major champion Federer and 14-time major champion Nadal.

What Djokovic really wanted to avoid was becoming only the fourth man in the Open era, which dates to 1968, to lose four consecutive Grand Slam title matches.

As the tennis circuit shifts to hard courts ahead of the U.S. Open, which begins in late August, Djokovic once again can confront on-court difficulty in peace. He said he feels more mentally prepared than ever, and gave some credit for that to Boris Becker, the three-time Wimbledon champion who joined Djokovic's coaching staff at the start of this season.

More than any sort of tactical improvements, Becker was hired to provide counsel so Djokovic could deal with hard times during the biggest matches.

"That's what we talked about most — and trying to prepare myself psychologically for what's (awaiting) me on the court in the critical moments, if they come. And there were many, many yesterday. We pushed each other to the limit. We both played some top tennis," Djokovic said Monday. "And, of course, having Boris on the side in the box ... was definitely helpful."

Against Federer, Djokovic was less animated — and agitated — than usual, and he said that was a result of a conscious decision to keep his emotions in check, in part to not let his opponent see signs of frustration.

After wasting a break point at the start of the second set when a forehand clipped the net and flew wide, Djokovic looked skyward and clasped his hands together, as though praying for a little assistance. Twice after hitting winners, Djokovic motioned to the Centre Court spectators to shower him with more noise and support.

Otherwise, though, Djokovic was restrained, by his standards.

Asked to relate particular advice that came from Becker, Djokovic replied: "He said that he knows I have the game to win this tournament, and I just need to hang in there and stay tough, regardless of what I go through on the court."

Away from the court, all is well for Djokovic.

He is about to get married to his pregnant fiancee, and they're expecting their first child later this year.

"Some really exciting times," Djokovic said, "and a new chapter in our lives that we are looking forward to."