What the U.S. Open got late Tuesday night was the invigorating jolt of a massive upset possibility — about a 5.0 on the Richter scale — plus, in the end, no hangover of waking up having lost the sport’s biggest star in the first round.

That 19-time major-tournament champion Roger Federer eventually survived a whiplash five-setter against 19-year-old American Frances Tiafoe wound up leaving everyone quite satisfied. Including Tiafoe.

“I just went 6-4 in the fifth, at night, first time ever on Ashe,” Tiafoe said, “against the greatest player of all time.” He proclaimed himself more proud than disappointed, leaving the court with Federer’s personal assurance that he is destined to be “a great player.”

“Means a lot that he thinks I have a future,” Tiafoe said.

Certainly, the sellout crowd in Arthur Ashe Stadium got its money’s worth in the 4-6, 6-2, 6-1, 1-6, 6-4 barn-burner. Even Federer insisted that a good time was had by all.

“The drama, the back forth, it was very exciting,” Federer said. “I really enjoyed myself, even though maybe I also was tired and nervous at the end. It was very cool to be part of that match.”

advertisement | advertise on newsday

Tiafoe drew inspiration from his ability to regroup in the fourth set, and the realization that Federer, as Tiafoe put it, “won by the skin of his teeth.” Federer was encouraged that he found himself in the fifth without a flare-up of recent pain in his 36-year-old back. “I said, ‘It’s great, I’m still in the match. Things are actually great,’ ” he said.

The Maryland-born son of Sierra Leone parents, Tiafoe took up the sport when he was 4 years old at a tennis center where his father worked on the construction crew and later as custodian. “Since I was a little kid, I dreamed of being on center court, playing the best in the world,” he said.

And there he was, playing —in his words — “pretty much lights out” in the fourth set. “The crowd was liking that. I’m pretty sure they would have liked me to have sneaked that one out. But the guy’s too good.

“Go down the list. Can’t read his serve. Jumps on the return ball better than anyone. Doesn’t give the baseline up. Takes time away. Best mover, by far. Just sees the game completely different than anybody else. He’s unbelievable.”

And he’s still around, after Tiafoe’s dandy show.