Novak Djokovic had become rattled by Tennys Sandgren and a boisterous Arthur Ashe Stadium that knocked him off his game.
But his most troublesome antagonist at the U.S. Open came from within.
"The other me," Djokovic said with a smile, "that my first me doesn't like."
The alternate version of himself that Djokovic detests — when his mind, more than his skill, becomes the problem — surfaced in a puzzling third set when the 31-year-old Serb was only one point from victory but couldn't close the deal.
"You just have to accept it sometimes," Djokovic said. "But that's being a human being, I guess. Not human doing."
Whatever it was, Djokovic straightened himself and kept on a path toward a third U.S. Open championship.
Djokovic wasted a match point in the third set, before going on to win 6-1, 6-3, 6-7 (2), 6-2 against Sandgren on Thursday night at the U.S. Open to reach the third round.
Djokovic had a much easier victory over Sandgren, an American ranked 61st, in Wimbledon's first round this year, dropping only six games in all.
The 13-time major champion seemed to be along the same path at Flushing Meadows, standing one point from victory while leading 5-4 in the third set as Sandgren served at 30-40. But Sandgren ended an 11-stroke exchange with a forehand winner, then took the tiebreaker.
Sandgren, who made a surprising run to the quarterfinals at the Australian Open, noticed Djokovic's dip in the third.
"It's tough to stay really focused and clean for three full sets. It's just difficult to do," Sandgren said. "If anybody can do it, he can. But he definitely blinked there for a moment."
Djokovic, the 2011 and 2015 champion, regained the upper hand with an early break in the fourth and was on his way.
But it wasn't a fan-friendly victory.
Djokovic whined at Wimbledon when he was booed at times on Centre Court and he complained again at the U.S. Open about fans who turned the night session into a bit of a party.
He got on the fans during his post-match interview on the court for talking during points and said he lost his concentration.
"You can't expect that 23,000 people are quiet," he said. "That's the beauty of night session U.S. Open. Everybody knows that. Wimbledon is all white, it's tradition. You can't hear a sound when you play a point. Here it's different. That's why these majors are unique in their own way."
He has reunited with coach Marian Vajda — they briefly parted ways and Djokovic had a brief dalliance with Andre Agassi — to marked improvement. Djokovic knocked off Roger Federer in August to win a title in Cincinnati and a renewed focus with Vajda has been a key factor.
"When he came back, obviously we had to analyze what has happened in the last 12 months that we were not together and try to understand the situation with my body, with my game," Djokovic said.
Djokovic, who missed last year's Open with a sore elbow, won his 13th Grand Slam title this year at Wimbledon.
To get 15, he'll have to keep his "other me" under wraps.