ST. LOUIS — When a team is having a year like the Yankees are, crises — if you can even call them that — tend to be short-lived.

The team with the best record in the American League came into Friday night’s game in St. Louis trying to avoid losing for the fourth time in its last five games, which would have equaled the toughest stretch of this charmed 2022 season. The Yankees turned to the pitcher who has been such a pleasant surprise, Nestor Cortes, and a bullpen that has been just as good as they thought it would be.

But for one of the few times in 2022, things didn’t work out, as the Cardinals scored twice off ace reliever Clay Holmes in the eighth inning and held on for a 4-3 win at Busch Stadium.

The Yankees’ most bankable asset — their power — was nowhere to be seen at Busch Stadium, a pitcher-friendly ballpark that New York hadn’t visited in eight years. For the first time in their last 20 games, the Yankees did not hit a home run. They also wasted multiple scoring chances in a game in which they out-hit the Cardinals, 10-5.

“Pretty frustrating. Definitely feels like a game we had control of the whole time,” Matt Carpenter said. “You think about how we swung the bat vs. the way they did. They had the one inning that kind of jump-started it and got them going. They have a good team over there and they were able to keep it close, and then they were able to put us away there at the end.”

Holmes was one out from getting his team into the ninth inning with a lead, but Paul DeJong hit the first pitch he saw for a two-run double into the right-field corner to give the Cardinals the lead. St. Louis closer Ryan Helsley got through the heart of New York’s order in the ninth.

Holmes is in a bit of a rut, having allowed nine earned runs in his last 7 1/3 innings after giving up just two in his first 39 1/3. Manager Aaron Boone decided to use him to get through the middle of the Cardinals’ order in the eighth rather than hold him for the ninth. This time, it didn’t work out.

“I really thought Clay threw the ball a lot better and was in command of what he was doing out there,” Boone said. “I didn’t feel like he was at a loss of command there. DeJong put a great swing on one that really hurt him, obviously.”

Another pleasant surprise for the Yankees didn’t disappoint his new team or the adoring fans here who came to wish him well.

Carpenter teared up in his pregame press conference while discussing how he had to explain to his 5-year-old son that, while he’s playing at Busch Stadium this weekend, he’s no longer doing so for the Cardinals. In 11 seasons in St. Louis, Carpenter had some of the greatest moments of his career at this ballpark, from the base-clearing double off Clayton Kershaw in the 2014 postseason — one of the last times he didn’t have a beard as a Cardinal — to a 2018 mid-summer rampage that saw him mash 20 home runs in a two-month stretch.

The crowd gave him a lengthy standing ovation in his first at-bat, with longtime teammate Yadier Molina standing in front of the plate to ensure Carpenter got his moment to bask in it.

Some things never change.

Carpenter, who has revitalized his career in pinstripes after two sub-.700 OPS seasons for the Cardinals, was in the middle of all the Yankees’ early scoring. He singled in his first two at-bats and moved a runner to third in each of his first three at-bats — and all three came in to score. Carpenter also missed a two-run home run by just a few feet in the seventh inning. Unlike Yankee Stadium, one of 19 stadiums in which that ball would have been a home run according to Statcast, Busch Stadium can be a difficult place for sluggers.

“I played here long enough to know that, if you think there’s a chance, there’s usually not,” Carpenter said. “You either know you got it. If you ever say, ‘Maybe,’ most of the time, it’s not. If you use the word, ‘Maybe,’ it’s usually not going to work here.”

Meanwhile, Cortes keeps rolling right along even as he approaches the greatest innings load of his career. The Yankees’ lefty, one of the fastest workers in baseball, offered a stark contrast to Cardinals starter Dakota Hudson, one of the slowest. Cortes largely breezed through his 5 1/3 innings, retiring nine straight batters at one point and allowing just one hit.

Cortes’s 112 2/3 innings are just 2 1/3 innings shy of his career high, so the Yankees will likely have to figure out how to limit his innings in the final two months of their playoff push. Perhaps they already have started doing so, because manager Aaron Boone took the ball from Cortes after just 83 pitches on a brutally muggy night after Paul Goldschmidt walked with one out in the sixth inning.

“Like I’ve said before, I’m never going to do the job of the manager,” Cortes said. “That’s way above my pay grade, and honestly, it’s hard to determine whether it’s a good time or not [to remove a pitcher]. Obviously, I’m not going to answer that question.”