Gael Monfils, of France, returns a shot to Roger Federer, of Switzerland, during the quarterfinals of the U.S. Open tennis tournament, Thursday, Sept. 4, 2014, in New York.

NEW YORK (AP) — Roger Federer saved two match points while coming all the way back from a two-set deficit to beat Gael Monfils 4-6, 3-6, 6-4, 7-5, 6-2 on Thursday night and reach the U.S. Open semifinals for the first time since 2011.

Frustrated by Monfils’ unpredictable style, flummoxed by the swirling wind, and missing shots he normally makes, Federer twice was a single point from losing while down 5-4 in the fourth set.

Gael Monfils, right, of France, shakes hands with Roger Federer, of Switzerland, after a quarterfinal in the U.S. Open tennis tournament, Thursday, Sept. 4, 2014, in New York. Federer won 4-6, 3-6, 6-4, 7-5, 6-2.

But he got out of that hole, starting a five-game run that put the match in his control for the first time all evening. It helped that Monfils’ quality of play dipped, including what wound up being a total of 10 double-faults.

This was the ninth time Federer has won a match after dropping the opening two sets.

Howard Fendrich

AP Tennis Writer