(CNN) -- Novak Djokovic ensured he will remain world No. 1 next week after overcoming a titanic challenge from Stanislas Wawrinka to reach the U.S. Open final for the fourth year in a row.
The 10th-ranked Swiss ended Andy Murray's title defense in the quarterfinals, and seemed set to inflict another major upset after winning the opening set in convincing style.
But last year's runner-up Djokovic twice came from a set down to take Saturday's opening semifinal to a decider before triumphing 2-6 7-6 (7-4) 3-6 6-3 6-4.
The Serbian will face Rafael Nadal in Monday's final -- a rematch of their 2010 and 2011 title clashes -- after the world No. 2 beat his childhood friend Richard Gasquet 6-4 7-6 (7-1) 6-2 in the second semi.
However, the Spaniard should have less fatigue to overcome before then -- he needed just two hours 21 minutes to beat the French eighth seed, while Djokovic was on court for just over four hours in a grueling contest.
He edged Wawrinka in a five-hour epic in the quarterfinals of the Australian Open in January before claiming his sixth grand slam title, but lost to Murray in the Wimbledon final in July after being drained by a five-set semi against Juan Martin del Potro.
Djokovic acknowledged that he had struggled to impose himself in the match against Wawrinka.
"It was obvious Stan played more aggressive. He played better tennis," he said. "I was trying to hang in there, to adjust.
"It was tough on both of us. I had to run a lot. I had to find my rhythm. I was just so fortunate to play my best tennis when I needed to."
Wawrinka said he was struggling physically with an injury picked up earlier in the New York tournament, where he reached the last four of a grand slam for the first time.
"Today I had the feeling when I was still fit, when I was still healthy, I had the match in control. I think I was playing better than him. I was doing much more things than him," the 28-year-old told reporters.
"But he's not No. 1 for nothing. He was staying with me all the match, and at the end he pushed me, pushed me far, far, far back. I had to find everything I had in my body today to stay with him, and he won the match."