Shelton fired an ace at 146 mph, a ball that Alcaraz couldn't have gotten back even with fresh legs.
That gave Shelton a 6-7 (5), 6-1, 6-3, 1-6, 7-6 (10-7) victory in a marathon tussle that was the latest-finishing match in U.S. Open history.
"I'm tired. It was a war," Shelton said. "Carlos is one of the greatest champions of our sport. It was the most enjoyable match I've had in my career, for sure."
Alcaraz had his 18-match winning streak in Grand Slam tournaments ended in a match that lasted 4 hours, 28 minutes, after he fought deep into the night and early into the next morning in a bid to get his hands on the trophy again.
"I mean it was close, it was really close, so I was disappointed I didn't get the win at the end," the No. 2-seeded Alcaraz said. "But I'm happy, I am proud of myself about how I fought. As I said, physically I was really tired but I found a way to push myself."
Shelton next plays No. 11 seed Frances Tiafoe, who kept coming back until he had reached his third U.S. Open semifinal, beating Alex Michelsen 5-7, 3-6, 7-5, 6-3, 7-6 (10-6) on Tuesday.
The U.S. is guaranteed to have a representative in Sunday's final as it seeks its first men's major title since Andy Roddick lifted the title here in 2003.
Alcaraz had played in the previous latest finish at the U.S. Open when he outlasted Jannik Sinner in a match that finished at 2:50 a.m. in the 2022 quarterfinals en route to his first Grand Slam title at 19.
Fans love the energy of a night match
The U.S. Open craves its night matches and players love the energy the fans provide - even when a number of matches have already gone past 2 a.m. this year.
Thousands stayed to the end, with Arthur Ashe Stadium perhaps still one-third full for the finish. Shelton benefited from a home-crowd boost even against the popular Alcaraz, with fans chanting his name along with "USA! USA!"
"It's incredible," Shelton said. "I always say that this is the greatest sports city in the world, I say that this is the greatest stadium in the world. I'm just hoping that my best friend and my sister over there don't have to be at work at 6 a.m. in three hours."
Three of the four singles quarterfinals went to match tiebreakers on a marathon day, which started with Aryna Sabalenka edging Wimbledon champion Linda Noskova to keep her hopes alive of a third straight U.S. Open title.
Alcaraz will have to wait for his next one.
Instead it was Shelton reaching his third major semifinal, having gotten to the final four in the 2023 U.S. Open and 2025 Australian Open.
He seized control by winning nine straight games from early in the second set until he had a 3-0 lead in the third. But Alcaraz, in his first tournament since April after returning from a right wrist injury, battled back even as he vomited before the start of the final set.
Alcaraz ran off four straight points in the tiebreaker to go ahead 5-3, but Shelton came back behind some of his powerful serves that can exceed 140 mph, along with some mistakes from Alcaraz. Shelton eventually finished it off with a 146 mph serve his opponent couldn't get back.
Alcaraz is now 15-2 in five-set matches. He won his seventh Grand Slam title at the Australian Open to start this year not long before his injury, and came to Flushing Meadows saying he didn't know what to expect.
'I leave with my head held high'
"I'm leaving happy and my head held high," Alcaraz said. "The truth is, I wanted to win ... but also our goal was to leave the tournament having played matches and staying healthy."
Tiafoe reached the semifinals in 2022 and lost to Alcaraz, when the Spaniard won his first of seven Grand Slam titles. Tiafoe lost to fellow American Taylor Fritz two years later, when the U.S. came closest to ending it's men's drought.
It certainly didn't appear Tiafoe would be going back this time, after Michelsen continued his dominant run through his breakout tournament. He was the only man who hadn't dropped a set, and he served to win the match with a 5-4 lead in the third.
He couldn't finish it off and Tiafoe charged back after falling behind 3-0 in the fifth set.
Tiafoe said his performance to start the match was slow and flat.
"It wasn't good, let's put it that way. It wasn't good," he said. "Three out of five is a blessing, because you have time to get it together. I definitely waited for the last minute."
Tiafoe joined Andre Agassi as the only American men to reach three U.S. Open semifinals this century and will return to the top 10 for the first time in three years in the next rankings.
Michelsen, ranked No. 46, fell to 0-6 in matches that go to a fifth set.