KANSAS CITY, Mo. — Royals manager Ned Yost simply ran out of options in his beleaguered bullpen.

Peter Moylan had pitched for the fourth straight day. Matt Strahm had gone consecutive days for the first time in his career. So, he summoned former starter Chris Young to the mound to hold down the Yankees, and he managed to get through one shaky inning before everything unraveled.

Didi Gregorius and Starlin Castro led off the 13th with hits, and Brian McCann delivered a go-ahead sacrifice fly off Strahm, as New York escaped with a 5-4 victory Wednesday night.

“What other options did I have?” Yost said with a touch of chagrin. “Unless I could have pulled somebody out of the stands — ‘Hey, you’ve ever pitched before?'”

Ben Heller (1-0) pitched a perfect 12th for New York to earn his first major league win, which Dellin Betances wrapped up by working around a leadoff walk for his seventh save.

“Everybody was calm under pressure,” said Yankees reliever Adam Warren, who contributed to seven shutout innings from the bullpen. “It was kind of neat to see Ben get his first win.”

Castro hit a two-run homer for the Yankees. Kendrys Morales hit one for Kansas City.

“We went through the trade deadline and I still felt we could win in here and these guys are showing it,” said Yankees manager Joe Girardi, whose club is just 2 1/2 games out of the second AL wild-card spot. “There’s a toughness in there and these guys really want it.”

The Royals appeared to have quickly erased the memories of their rain-delayed, 5-4 loss in 10 innings the previous night when Morales homered for the second straight game with two outs in the first.

Kansas City added another run off Luis Cessa in the second on an error by third baseman Chase Headley and a timely double by Alcides Escobar, then made it 4-0 when Eric Hosmer homered to left in the third.

Ian Kennedy was cruising along for Kansas City until the sixth, when Gregorius lofted a sacrifice fly to left field. Castro followed moments later with his two-run shot.

Kennedy’s night was done when he walked Aaron Hicks with one out in the sixth. Scott Alexander came in and gave up a single to Brett Gardner and Jacoby Ellsbury’s tying sacrifice fly to center.

Both teams had chances to push runs across before the 13th inning.

The Royals’ Raul Mondesi drew a leadoff walk in the seventh and Jarrod Dyson dropped a sacrifice bunt to get him to second base with only one out. But Mondesi got caught straying between second and third, and Cheslor Cuthbert promptly struck out to end the inning.

In the 11th, Salvador Perez walked and pinch-runner Billy Burns stole his way to third. He wound up stranded there when Paulo Orlando ripped a line drive right at Castro at second base.

The Yankees loaded the bases with one out in the 12th, but Gary Sanchez lined out to Cuthbert at third base and Mark Teixeira chopped a grounder to shortstop to end that threat.

“The off day is going to do us good tomorrow,” Yost said. “Everybody is going to be able to recharge a little bit. It’s going to be good for us to just relax a little bit.”

YANKEES DEAL

The Yankees sent OF Ben Gamel, the MVP of the International League, to Seattle for minor league RHPs Jio Orozco and Juan De Paula on Wednesday. They also sent cash to Milwaukee for speedy OF Eric Young Jr., who Girardi said could join the club when rosters expand later this week.

ROYALS MOVES

RHP Chien-Ming Wang was placed on the DL with biceps tendinitis after tossing two scoreless innings on Tuesday night. The Royals shored up their taxed bullpen by recalling Alexander and RHP Brooks Pounders from Triple-A Omaha and optioning INF Christian Colon to the same club.

TRAINER’S ROOM

Yankees: Hicks left the game after grounding out in the ninth, limping his way to the dugout with a right hamstring strain. “I’m concerned,” Girardi said. “It’s probably not a day-to-day thing.”

Royals: CF Lorenzo Cain (sprained wrist) got the night off. He’s been playing in pain for about two weeks. “It’s been pretty sore,” Yost said. “It’s not a thing that’s going to heal in a week.”

UP NEXT

The Yankees take Thursday off before sending RHP Chad Green to the mound to start a three-game set in Baltimore on Friday night. LHP Danny Duffy gets the call for the Royals when Detroit visits Friday night to open their three-game series at Kauffman Stadium.