The No3 seed was facing the young American Frances Tiafoe and he shouldn’t have posed too many problems.
But Federer was forced to dig deep before prevailing in five sets – 4-6, 6-2, 6-1, 1-6, 6-4.
Tiafoe came out firing from the first ball and broke the Swiss in the opening game of the first set.
Federer was making too many unforced errors on the backhand side and Tiafoe closed out the first set with a crunching forehand winner.
Federer appeared to be gathering steam and surged to the third in breakneck speed.
But Tiafoe wasn’t letting Federer have things all his own way.
The 19-year-old levelled things up in the fourth set to take it to a decider.
Tiafoe was now clinging on as Federer had a service hold to love.
He lost a challenge on Federer’s serve which clipped the line.
Federer missed the chance to clinch the match at the first time when he dumped a backhand volley into the net.
He had 10 unenforced errors in the final set, but after dropping his serve, got two match points on Tiafoe’s serve.
And he took the second one when Tiafoe’s forehand was dumped into the net.