Brian McCann delivered a sacrifice fly in the 13th inning and Dellin Betances shut down the Kansas City Royals in the bottom half to give the New York Yankees a 5-4 victory Wednesday night.

Royals reliever Chris Young (3-9) gave up a single to Didi Gregorius and a double to Starlin Castro to lead off the decisive frame. Matt Strahm came in against McCann for a lefty-lefty matchup, and the New York designated hitter lofted a fly ball to left to score the go-ahead run.

Ben Heller (1-0) pitched a perfect 12th to earn his first major league win, while Betances wrapped up a winning series for the Yankees by working around a leadoff walk for his seventh save.

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

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.

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 manager Joe 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 LHP Scott 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. Aaron Judge replaced him in the lineup.

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," manager Ned 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.