The 26-year-old Serbian, a six-time major winner and 2011 US Open champion, will play for the title Monday against 12-time Grand Slam champion Nadal.

Nadal extended his streak without losing a service game to 73 before eighth-seeded Gasquet broke him in the fourth game of the second set. Both players held through the tiebreaker, which Nadal won easily.

Djokovic booked his 12th Grand Slam trophy match, and fourth US Open final in a row, after four hours and nine minutes on his ninth ace, the sellout crowd at wind-swept Arthur Ashe Stadium giving both men a standing ovation.

I was just so fortunate to play my best tennis when I needed to

Novak Djokovic, World number one

"It was obvious Stan played more aggressive. He played better tennis," said Djokovic.

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

An epic third game of the fifth set lasted 21 minutes, Wawrinka fighting off five break points to hold for a 2-1 lead after 30 points, reaching deuce 12 times.

The Swiss denied Djokovic break points with forehand, backhand and service winners as well as two netted backhands by the Serb before closing out the game on a service winner.

"I was thinking, 'Whoever wins this game is going to win this match,'" said Djokovic.

"After he won that game I was thinking, 'I have to fight against those odds.'"

'Great match'

But Djokovic finally capitalized on his eighth break point of the last set when Wawrinka swatted a backhand beyond the baseline to give him a 3-2 lead.

The reigning Australian Open champion had converted only 3-of-18 break points up to that moment, but took the critical break and held the rest of the way to advance, dropping Wawrinka to 0-13 against world number ones.

"These matches are what we live for," Djokovic said.

"I want to congratulate my opponent for fighting hard until the end. It was a great match."

Wawrinka, in his first Grand Slam semi-final, fired plenty of winners early but struggled to connect on even half his first serves while Djokovic, undone by unforced errors most of the first two sets, found his form and battled back.

"It was a great tournament for me," Wawrinka said after his first Grand Slam semi-final, a run that included his quarter-final ouster of defending champion Andy Murray.

"Tough match to have lost. I gave everything. I fight until the end. I tried. It was an amazing experience."

The victory ensured Djokovic will stay atop the rankings after the US Open no matter how he fares in the final. Nadal leads their personal rivalry 21-15 while Djokovic owns an 8-1 career edge over Gasquet.