Federer seemed to get back on track in the third set. After Dimitrov double-faulted on break point at 3-2, Federer won the next three games.

But he was broken in the first game of the fourth set, and a spattering of errors turned into a deluge. He made 19 unforced errors, 11 on the forehand side. His success on first-serve points plummeted from 93 percent to 61 percent. He had five break points when Dimitrov served for the set at 4-5, and could not convert any of them.

After his medical timeout, Federer quickly fell behind by 3-0 in the deciding set, being broken in his first two service games. Dimitrov lost only one point on his own serve in the set. Federer finished with 61 unforced errors, 33 on the forehand side.

Federer said he had an upper back problem that started Tuesday afternoon, but he did not want to dwell on it. “This is Grigor’s moment, not my body’s moment,” he said.

In the semifinals on Friday, Dimitrov will face another first-time U.S. Open semifinalist: fifth-seeded Daniil Medvedev, who won, 6-7 (6), 6-3, 3-6, 6-1, over the 2016 champion Stan Wawrinka on Tuesday afternoon.

Federer’s exit follows those of the two No. 1 seeds in singles, Naomi Osaka, who lost Monday, and Novak Djovokic, who retired from his fourth-round match Sunday because of a shoulder injury.