By Larry Fine

NEW YORK (Reuters) - Novak Djokovic fought off two match points with huge winners en route to a thrilling 5-7 6-1 5-7 6-2 7-5 upset of five-time U.S. Open winner Roger Federer on Saturday to reach the final of the year's last grand slam.

The third-seeded Serbian had been eliminated by the Swiss master in the three previous U.S. Opens, but he returned the favor by winning a nail-biting fifth set in the semi-final to reach the championship match against top-seeded Rafa Nadal.

Djokovic, runner-up in 2007 and a semi-final loser the past two years, dropped to his knees and kissed the court after the second-seeded Federer's forehand landed wide on match point.

"It was just a big pleasure playing in this kind of match," the 23-year-old Serb told the Arthur Ashe Stadium crowd after the intense, three-hour 44-minute battle. "It's one of those matches you'll always remember in your career. I'm just so thrilled to be in the final."

Nadal routed 12th-seeded Russian Mikhail Youzhny 6-2 6-3 6-4 in the other semi-final to book a spot in the final where he will look to complete a career grand slam.

Djokovic was on the ropes at 15-40, facing double match point, serving at 4-5 in a final set that had gone on serve.

With everything on the line, the slender Serb saved the first with a forehand drive volley winner and then rifled a topspin forehand into the corner to bring the game to deuce.

"If it goes in, it goes in. If it goes out, you know, another loss to Federer in the U.S. Open. I managed to come back. I was very lucky."

After surviving that challenge, Djokovic broke a deflated Federer in the next game when the Swiss hit a forehand wide up the line to grab a 6-5 lead.

Serving for the match, Djokovic fought off a break point at 30-40 when Federer sent a forehand long. The second seed then netted a forehand to set up match point.

"I feel somewhat empty at the end," said Federer, last year's runner-up to Juan Martin Del Potro of Argentina, whose string of six successive U.S. finals was stopped. "You tried everything.

"Obviously you feel like you left something out there if you lose a match and had match point."

Federer said the only saving grace in defeat was that it did not come in the final, which would have hurt even more. "It was electric," he said about the quality of play and the response from the crowd.

"It was good tennis at the end."

(Reporting by Larry Fine, Editing by Frank Pingue)