It was a combination of joy and relief for Roger Federer after he beat Gael Monfils at the U.S. Open.

Follow us at @WorldSportCNN and like us on Facebook

Story highlights

Roger Federer rallies from two sets down to beat Gael Monfils in New York

Monfils held two match points on Federer's serve at 5-4 in the fourth set

The Swiss next meets resurgent Croatian Marin Cilic in the semifinals

Serena Williams plays Ekaterina Makarova in the women's semifinals Friday

CNN  — 

Roger Federer has reached the U.S. Open semifinals for the first time since 2011, but he sure had to do it the hard way.

Federer saved two match points and rallied from two sets down to defeat enigmatic Frenchman Gael Monfils 4-6 3-6 6-4 7-5 6-2 in a late-night thriller in New York.

The two played in Cincinnati just a few weeks ago and Monfils stretched Federer to a deciding third set.

He was even closer to upsetting the 17-time grand slam champion under the lights at Arthur Ashe Stadium on Thursday, holding two match points on Federer’s serve at 5-4 in the fourth.

While Federer saved the second match point with a winning forehand, Monfils had an opportunity on the first match point, only to miss a backhand long.

Monfils never recovered.

He double faulted twice to drop serve in the next game, Federer held to claim the set and the 33-year-old then cruised in a quick fifth set.

It was the ninth time in his career Federer came back from two sets down.

The last time it happened was at Wimbledon in 2012 – against another Frenchman, Julien Benneteau.

In a potentially good omen for Federer, he went on to win the title at the All England Club – his last success at a major.

“I got off to a good start, so I was actually feeling alright, but then when I was down two match points, that’s when I wasn’t feeling so great anymore,” Federer, 28-1 in night session matches at the U.S. Open, said on court afterwards. “I thought, ‘This is it. This is the last point, man, just go down fighting, don’t miss an easy shot and let him have it.’

“But I served well and stayed in the match and somehow turned it around. I felt great in the fifth, though.

“I was really starting to play better and better as the match went on, and that’s a great feeling.”

Federer faces the resurgent Marin Cilic in Saturday’s semifinals after the big-serving Croat dispatched Czech sixth seed Tomas Berdych in straight sets.

A year ago Cilic sat out the U.S. Open due to a doping suspension.

The other semifinal sees top seed Novak Djokovic meet Japan’s Kei Nishikori, a maiden grand slam semifinalist. They won their quarterfinals Wednesday.

For Monfils and France, it marks more disappointment.

The country’s wait for a men’s grand slam singles champion will extend to 32 years.

“I will need time to forget about this match, but it gives me more motivation,” the 24th-ranked Monfils was quoted as saying by L’Equipe.

“He (saved) those two (match points), so bravo to him. After that it was hard because my serve wasn’t good. He played well and me, I had a (dip) for five minutes.

“I felt tired physically and mentally, too, and he was very aggressive at that time.”

Serena Williams and pal Caroline Wozniacki will meet in the women’s final if they both – as expected – progress Friday.

Williams, the only grand slam singles champion of the women’s semifinalists, plays Russian left-hander Ekaterina Makarova and former No. 1 Wozniacki plays China’s Peng Shuai.

Makarova, though, owns a grand slam win over Williams at the Australian Open in 2012.

Read: Cilic overcomes Berdych