Novak Djokovic said talking to himself in the mirror when he was two sets down was the turning point as he beat Jannik Sinner to reach the Wimbledon semi-finals.
The top seed and defending champion, bidding for a fourth successive SW19 title and seventh overall, came through 5-7 2-6 6-3 6-2 6-2 on Centre Court.
Serb Djokovic, 35, will play Britain's Cameron Norrie next.
"He was the better player for the first two sets," Djokovic said.
"I went out and had a refresh, had a toilet break, I had a little pep talk to myself in the mirror, it's the truth.
"Sometimes in these circumstances when not much is happening positively for you, sometimes these things are necessary. A little break to try and regather the thoughts and reassemble."
Djokovic was given a huge scare by Italian 10th seed Sinner, who initially rose to the occasion as he tried to reach a Grand Slam semi-final for the first time.
However, the 20-year-old faded in the final three sets as Djokovic improved after an erratic and subdued opening.
There was no suggestion of the drama ahead when Djokovic moved 4-1 ahead in the first set and brought up a break point for 5-1, but his level suddenly dropped just as Sinner grew into the match.
Groundstrokes began to fly long and drop shots either flopped into the net or sat up for Sinner to put away as the Serb fell two sets behind, at risk of his first defeat at Wimbledon since retiring from the 2017 quarter-final against Tomas Berdych because of a shoulder injury.
It has been difficult to judge where Djokovic's game is this year as he did not play the Australian Open and the American hard-court swing because of his Covid-19 vaccine status.
Having lost to Rafael Nadal in the French Open quarter-finals, he did not play a grass-court warm-up tournament but had reached the last eight here for the loss of just one set.
Perhaps the lack of his usual matchplay had an effect here, and he showed little emotion as he dropped serve twice in both the first two sets and was thoroughly outplayed by the more aggressive Sinner.
After his toilet break at the end of the second set, a more recognisable Djokovic appeared. He began to step into the ball rather than scramble behind the baseline, and a break to love for 3-1 gave him a foothold in the match.
At 30-30 in the next game, Sinner netted a makeable volley and Djokovic engaged with the crowd for the first time, waving his arms and encouraging them to make more noise.
Sinner saved two set points at 5-2 down but Djokovic wrapped it up in the next game, dropping only five points on his serve in the third.
Two Sinner double faults set Djokovic on his way immediately in the fourth set and he then broke again as he moved 4-0 up. The Italian did become more competitive towards the end of the set, but he had a scare when his left foot slipped as he chased a volley.
He grabbed his ankle and was down for a while, but was fine to continue after Djokovic came round the net to check on his condition and helped him to his feet.
The crowd got behind Sinner and roared in encouragement when he held at the start of the final set, but a tentative volley and weak drop shot that both found the net gave Djokovic a break for 2-1.
There seemed little doubt now about the result and Djokovic duly moved on after a spectacular backhand cross-court winner, which left him lying flat on his chest, was followed by a wild drive volley from Sinner on match point.
Djokovic said his "pep talk" at the end of the second set was entirely "positive".
He added: "As negative and down as you feel on yourself in those moments, even though as fake as it looks or sounds to you, it really gives you an effect and support if you are trying to find the right and positive affirmations and tell it to yourself and kind of reanimate yourself in a way.
"So that's what I have done. I've done that after I lost two sets in finals of  Roland Garros against [Stefanos] Tsitsipas, and today it worked. It doesn't always work. It's not a guarantee it will always work."
BDST: 1350 HRS, July 6, 2022