DENVER — Some 30 minutes had passed since the end of an epic night of soccer, and most of the U.S. men’s national team remained on a confetti-sprinkled field usually reserved for Denver Broncos celebrations. The players mugged for photos, admired their championship medals and took turns hoisting the stone-and-silver-plated trophy.

They didn’t win the World Cup or qualify for it late Sunday night. The Concacaf Nations League didn’t even exist three years ago.

But amid Coach Gregg Berhalter’s efforts in molding a young squad and returning it to international respectability, the 3-2 extra-time victory over battle-tested Mexico was a big deal.

Since the embarrassment of missing the 2018 World Cup, the U.S. men have not had anything to celebrate. Wins in friendly matches are cute but don’t mean much. A younger squad again failed to qualify for the Olympics. The women’s program is the beacon of success.

So excuse Berhalter’s boys for relishing every last drop of a championship against their regional nemesis in front of a rowdy crowd of 37,648 that largely favored the visitors.

“It’s got to go down as one of the best U.S.-Mexico games I’ve ever seen or been a part of — amazing, amazing,” midfielder Sebastian Lletget said. “It’s a huge step for this group. It gives us more belief that we can really go forward and can play with the big teams.”

Mexico and the United States have been the biggest teams in the region for a long time. Mexico has maintained an elite level, but the Americans have had to rebuild around a core of players with grand European club portfolios but undeveloped international chops.

“We’re a young side,” Berhalter said, “and we need to learn how to win.”

The United States won Sunday because it rebounded from both an early deficit and a late deficit. It won because it played with courage and resilience in the face of several dodgy episodes.

It survived the loss of starting goalkeeper Zack Steffen, whose knee injury midway through the second half led to Ethan Horvath’s entrance. Horvath followed Christian Pulisic’s go-ahead goal by stopping Andrés Guardado’s penalty kick in the waning moments.

“For a keeper to come into a game like that, it’s already eye-rolling and going 100 miles per hour, to make the big save and secure the win was big time,” midfielder Weston McKennie said. “He went with his gut, his instinct, his training, and stepped up to the role.”

At the team’s downtown hotel Sunday morning, Horvath said, he, Steffen and third-stringer David Ochoa met with goalkeepers coach Aron Hyde to prepare for the possibility of facing penalty kicks in the game or in a tiebreaker. For all practical purposes, Steffen would be on the spot. Rarely do goalkeepers leave games.

The group “spent a good 30, 40 minutes watching penalties, just in case,” said Horvath, the backup at Belgian champion Club Brugge. “Any one of us was prepared to step in goal. It’s down to us doing our homework.”

Horvath, 25, provided the heroics in front of two-dozen friends and family. He is from Highlands Ranch, a Denver suburb, but because of a well-established European career, he said he hadn’t been home in three or four years.

Sunday marked his sixth appearance for the national team. While Steffen was with Manchester City for the UEFA Champions League final, Horvath started in the friendly at Switzerland on May 30, then took his place back on the bench for the Nations League.

“Thinking about how difficult it is for goalkeepers to come into that stage of the game,” Berhalter said, “and then to make the impact that he made was remarkable.”

Horvath had forced extra time with a superb save on Hirving Lozano’s rocket in the 90th minute.

There were other heroes. McKennie showed why he plays regularly alongside Portuguese superstar Cristiano Ronaldo at Italian power Juventus by giving an elite all-around performance that included the 82nd-minute equalizer.

Pulisic stepped up at the decisive moment, waiting out delays and ignoring Mexican players’ efforts to unnerve him before smoking his penalty kick into the top corner.

“I said I was going to go out swinging and I am going to go for it,” Pulisic said of his attempt.

Eight days earlier, he won the Champions League trophy with Chelsea. Sunday, as the captain, he accepted the Nations League jewel. “It’s the perfect way to end the year,” he said.

His front-line partner, 18-year-old Gio Reyna, scored the first U.S. goal and assisted on McKennie’s goal with a well-placed corner kick. He also received a major scare after Pulisic’s goal when, during the celebration in the corner, an object thrown by a spectator hit him in the head. He required treatment on the field before being helped to the bench.

“Total lack of respect for what’s happening on the field and all the effort both teams were putting into the game,” Berhalter said of the deluge of water bottles and other items. “Really disappointed to see. It could’ve been a lot worse” for Reyna.

The match was also marred by fans using a Spanish homophobic chant, a constant issue at Mexico games. After a three-minute pause, there were no further incidents.

The evening included multiple scuffles, three video replays (two in favor of the United States), a red card to Mexico Coach Gerardo “Tata” Martino and a Mexican player shoving Berhalter on the sideline as the coach attempted to flip the ball to one of his players for a throw-in.

All that was missing on this absurd and entertaining night was a penalty-kick tiebreaker that went a dozen or so rounds.

Berhalter will not savor the victory for long. He has to get his team ready for a friendly against Costa Rica on Wednesday in Sandy, Utah. Then he’ll select an MLS-heavy squad for the Concacaf Gold Cup, a regional championship starting July 10 and, in all likelihood, featuring another U.S.-Mexico clash.

World Cup qualifying will start in September, with two matches against Mexico as part of the 14-game U.S. schedule.

Sunday’s victory, though, promised to continue shaping a talented but young team ahead of the competition that matters most.

“We’ve still got a long way to go,” Pulisic said, “but we’re happy.”

Read more on soccer: