Yankees relief pitcher Clay Holmes pauses on the mound after...

Yankees relief pitcher Clay Holmes pauses on the mound after giving up a two-run double to the Cardinals' Paul DeJong during the eighth inning of a game Friday in St. Louis. Credit: AP/Jeff Roberson

ST. LOUIS — A Yankees bullpen fortified at the trade deadline because of the way it had taken it on the chin in the previous month-plus performed much in the same manner Friday night.

Facing the kind of team it could see in the postseason, the Yankees couldn’t hold on to a late lead and fell to the Cardinals, 4-3, in front of a sellout crowd of 46,940 at Busch Stadium.

The Yankees (70-37), playing here for the first time since 2014, led 3-2 going into the eighth before Clay Holmes allowed a two-out, two-run double to .137-hitting Paul DeJong.

After retiring Paul Goldschmidt on a grounder to begin the eighth, Holmes allowed an infield single by Nolan Arenado. He struck out Nolan Gorman on three pitches but walked Tyler O’Neill. DeJong — 13-for-95 to that point and demoted to Triple-A Memphis in May because of his offensive struggles — then roped a two-run double into the rightfield corner to give the Cardinals a 4-3 lead.

“Tough inning,’’ said Aaron Boone, who would have used Aroldis Chapman in the ninth if Holmes had gotten through the eighth. “Especially when I thought Clay threw the ball a lot better [than in some previous outings] and was in command of what he was doing out there for the most part.”

Said Holmes, ‘’Definitely felt a lot better out there tonight, but at the end of the day, the two runs scored and that’s really the only thing that matters. Nights like this are tough, especially when you do feel pretty good. You have to make the most of those, especially with a one-run lead, but wasn’t able to do it tonight.”

According to ESPN Stats & Info, entering games on July 9, the Yankees were 53-0 when leading in the eighth inning or later. Since then they are 7-4.

Ryan Helsley walked DJ LeMahieu with one out in the ninth but Aaron Judge popped out and Matt Carpenter barely was thrown out at first on his checked-swing grounder into the shift (his bid for a two-run homer in the seventh was caught at the wall).

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

The Yankees outhit the Cardinals 10-5 after holding a 9-1 edge at one point. They stranded nine and watched the Cardinals score all four of their runs on two-out hits.

“It’s not easy for us right now,’’ Boone said. “We’re kind of close. A lot of good at-bats today, a lot of hits. I thought a lot of quality at-bats up and down, but just couldn’t get that one back-breaker to kind of pull away.”

Nestor Cortes entered the game 9-3 with a 2.53 ERA, having allowed two or fewer earned runs in 14 of his 19 starts, and mostly pitched to those numbers Friday. The lefthander allowed only one hit — a two-out RBI single by Yadier Molina that tied the score at 1-1 in the second — and four walks in 5 1⁄3 innings.

Albert Abreu, whom the Yankees are auditioning for an October bullpen role, allowed a runner he inherited from Cortes to score. Scott Effross pitched 1 1⁄3 scoreless innings in preceding Holmes to the mound.

The Yankees gave Cortes the lead before he threw a pitch. LeMahieu, who brought a team-best .392 on-base percentage into the night, drew a walk against Dakota Hudson, making it 34 of his last 35 starts in which he reached base. Judge lined out to left, which brought Carpenter to the plate.

Carpenter, drafted by St. Louis in 2009 and a Cardinals major-leaguer from 2011-21, received a prolonged ovation when he was introduced before his first at-bat and ended a seven-pitch battle against Hudson with a single to right that put runners at the corners. After Gleyber Torres struck out, Josh Donaldson doubled to center for a 1-0 lead.

The Cardinals tied it in a 30-pitch second as Cortes lost command of the strike zone. He walked Arenado to start the inning, retired the next two batters, and walked DeJong. Molina then banged one back up the middle to tie it at 1-1.

“Very frustrating,’’ Cortes said. “I’m known as a strike-thrower. It’s hard to give up two walks and give up that single to Yadi there.”

The Yankees retook the lead in the third. Judge flared a single to right and Carpenter lined a single to right to put runners at the corners. Torres struck out on three pitches, but Donaldson scorched an RBI single to center for a 2-1 lead.

Judge blooped another single to right in the fifth, stole second and reached third on Carpenter’s groundout. Torres’ sharp grounder off reliever Andre Pallante went for an RBI single that made it 3-1.

O’Neill’s two-out RBI single off Abreu in the sixth brought the Cardinals within 3-2.

More Yankees headlines