NEW YORK — When 20-year-old Ben Shelton walked out onto the Arthur Ashe Stadium court Tuesday night, there was a buzz in the air and history on the line.

Shelton was playing against Frances Tiafoe in the first all-American men’s quarterfinal at the Open in 18 years. The Atlanta native and 2022 NCAA singles champion from the University of Florida was bidding for his first Grand Slam semifinal after making a stirring run to the Australian Open quarterfinals in January, the first time in his life he had left the country. Shelton was also the youngest American man since Andy Roddick in 2002 to reach the quarterfinals. And he and Tiafoe are both men of color, adding another historical dimension to the occasion.

With all that at stake, Shelton rose to the occasion and scored the biggest win of his young life, dispatching No. 10 Tiafoe in their first meeting, 6-2, 3-6, 7-6 (7), 6-2 before some 24,000 fans in oppressively humid conditions. At a tournament where five American men were seeded, the unseeded Shelton is the last American man standing.

“I feel like I left it all out here tonight,” he said on court after taking out Tiafoe, a semifinalist a year ago. “Emotional battle and thanks all you guys for staying so late. Hell of an atmosphere and thanks for pushing me over the line.”

Shelton’s reward is a date with No. 2 Novak Djokovic — the 23-time major champion and tournament favorite — in Friday’s semifinals.

“Yeah, he’s won maybe 23 of these, something like that,” Shelton said with a smile on the court. “It doesn’t get much better than that, you know. It’s been tough the last two matches, I’ve been playing Americans. But hopefully you guys bring it for me two nights from now.”

Both men will have two full days of rest before that showdown.

“I have to be ready for a great battle,” said Djokovic, who is bidding to pass Serena Williams and tie Margaret Court for the all-time record with 24 major titles.

“You know, both of the guys that I’m going to face eventually on Friday, Shelton and Tiafoe, have a lot of charisma. They bring a lot of energy on the court. They are very quick, very powerful. I mean, Ben Shelton has been serving some bombs this tournament. When his serve is on, he’s a very difficult player to play against, especially because he’s lefty, as well.

The 6-foot-4 Shelton was born in Atlanta because his father, Bryan, a former pro who reached a career-high of No. 52 in the world, was then the coach of Georgia Tech’s women’s tennis team. His father is African-American and his mother is white. Both his parents were rooting him on from his player box, with his father occasionally urging him to go for less on his second serve when he was hitting them at 140 mph.

Shelton, who now lives in Gainesville, Fla., is also still alive in the mixed doubles with partner Taylor Townsend, unless he opts to pull out. They are set to meet No. 1 seeds Jessica Pegula and Austin Krajicek in an all-American semifinal showdown on Wednesday at 4 p.m.

Despite the age gap, Shelton played with more poise early. He broke Tiafoe in the fifth game of the match for a 3-2 lead when Tiafoe committed three forehand errors. Two games later, Shelton earned a double-break for 5-2 when Tiafoe sent a backhand wide.

Shelton served out the first set with a 127-mph service winner.

“It’s gotta be the nerves, he’s expected to win, expected to defend the points [from last year],” James Blake, who was among the last trio of American men to reach the quarters in 2005, said of Tiafoe on ESPN.

After dropping the second set, Shelton earned an early break in the third for a 3-1 lead, but he couldn’t build momentum.

Tiafoe broke him twice in a row for a 4-3 edge. On one point, Shelton looked toward his player box and said, “So bad.”

In the third-set tiebreak, Shelton’s big weapon let him down. He had two set points at 6-4, but double faulted twice in a row on his serve, giving Tiafoe a 7-6 lead. Shelton then saved a set point with a 105-mph forehand winner into the corner.

“Sometimes you gotta shut off the brain, close your eyes and just swing,” Shelton said. “And maybe it was a little bit of that down set point but ended up working out. Some would say clutch, but I don’t know about all that.”

Serving at 8-7, Shelton won the set on his serve on a baseline exchange that ended with Tiafoe sailing a running backhand long and Shelton cupping his hand to his ear to urge on the crowd’s applause. Tiafoe had been 9-0 in tiebreakers at the U.S. Open coming in.

In the first game of the fourth set, Shelton drilled a backhand winner up the line on break point and screamed toward his box, “Yeah!”

Shelton earned a double-break for 5-2 when Tiafoe netted a forehand and Shelton then grimaced and raised his fist.

On his second match point, Shelton won it with a crosscourt forehand winner. His parents hugged in the box and Shelton and Tiafoe embraced at the net.

Shelton has received praise from several American stars during his run at this Open, too.

Jets quarterback Aaron Rodgers, who watched Shelton defeat fellow American Tommy Paul on Sunday, posted on Instagram after Shelton bombed two 149-mph serves. “I was stunned. Kid is special.”

Coco Gauff, who is into her first U.S. Open semifinal on Thursday night, was looking forward to watching the Shelton-Tiafoe matchup.

“I’m just really excited to see so many Americans in the quarters, especially two people that I’m really close with on tour,” she said. “I’m really just hoping for a good match, I’m proud of both of those guys. They both have been through a lot of adversity this year, and then also Ben doing well and Taylor [Townsend] doing well in mixed so we have a real opportunity to get some trophies on all ends of the event, and that would be really exciting but it’s a great time to be an American tennis player.”

Peyton Stearns, who won the 2022 NCAA singles championship at Texas and lost in the fourth round of the Open on Monday, was also rooting for Shelton.

“I just saw him in the hallway and we just chatted a little bit,” Stearns said of Shelton after her loss. “I think it’s a good thing. We feed off of each other. We both won [the NCAA singles title] the same year. It’s pretty impressive to see what he’s doing on the men’s tour and vice versa. So we’re not competing against each other and we’re both American so I think we’re both rooting for each other.”