Roger Federer already has dropped two more sets at the US Open than he did during his entire two weeks en route to the title at Wimbledon.

Worried about a recent back problem that kept him from getting ready the way he usually does for a Grand Slam tournament, Federer had to overcome an early deficit and a late lapse Tuesday night to edge 19-year-old American Frances Tiafoe 4-6, 6-2, 6-1, 1-6, 6-4 in a compelling first-round contest under the Arthur Ashe Stadium roof.

“I didn’t have the preparation I was hoping to get,” Federer said. “I always knew I was going to come in feeling rusty or not great.”

US Open first round: Roger Federer v Frances Tiafoe – as it happened Read more

The No3-seeded Federer, whose most recent of five championships at Flushing Meadows came in 2008, got broken in the first game and dropped the opening set of the topsy-turvy match. He then appeared to take control by grabbing eight of nine games to seize the second and third sets. But he let that lead slip away. There was more trouble when Federer served for the match leading 5-3 in the fifth and got broken.

“I was quite up and down,” Federer said, acknowledging that he was cautious with his footwork and had some trouble seeing the ball properly.

Tiafoe’s take: “He won by the skin of his teeth.”

Federer’s initial match point came at 5-3, 40-30, but Tiafoe staved that off, then broke. He produced a cross-court forehand winner at an unbelievable angle to earn the chance, before converting it with a terrific forehand passing winner down the line. Tiafoe roared and pumped a fist and sprinted to the sideline for the changeover.

When he had to come back out and serve, Tiafoe was a bit flat. Federer wasted his second match point with a netted backhand. On the third – with Federer’s wife, Mirka, covering her eyes in the stands – Tiafoe hit a stumbling forehand into the net.

“In these best-of-five-set matches,” Federer said, “you have a lot of lives sometimes.”

It was Federer’s 79th career victory at the US Open, equaling Andre Agassi for second-most. Only Jimmy Connors has more, with 98.

Federer played with the roof shut at Ashe for the first time. He missed last year’s tournament, when the retractable cover made its debut, because he took off the second half of 2016 to let his surgically repaired left knee and a bad back fully heal.

“It felt like people were happy to see me again,” Federer said.

In 2017, he is 36-3 with five titles, including the Australian Open and Wimbledon, where Federer won every set he played across seven matches while collecting his record eighth trophy at the All England Club and 19th Grand Slam championship overall.

For more than a half-hour Tuesday, it appeared as if Federer was still dealing with the after-effects of having tweaked his back during a loss in the hard-court final at Montreal this month. He sat out the following week’s tournament at Cincinnati.

At least, Federer said, his back was not in pain Tuesday.

“My hope and my belief is that it’s only going to get better from here,” Federer said.

Tiafoe, who is from Maryland and now is based in Florida, is ranked 70th and has never been past the second round at a major tournament.

This was his second match against Federer. Tiafoe pushed Federer to a first-set tiebreaker when they faced each other in March at the Miami Masters before losing in two sets.

“Eventually,” Tiafoe said, “I’ll win more than I lose these.”