Yankees third baseman Ryan McMahon celebrates his 11th-inning walk-off single...

Yankees third baseman Ryan McMahon celebrates his 11th-inning walk-off single against the Tampa Bay Rays with teammates at Yankee Stadium on Wednesday. Credit: Brad Penner

There was a colossal blunder by Austin Wells. There was Devin Williams’ first blown save since April 25. But the Yankees managed to shake both of those off against the Rays and continued their drive for a playoff spot by prevailing in a zany back-and-forth contest for a 5-4 victory in 11 innings before 43,355 at the steamy Stadium on Wednesday night.

Ryan McMahon drove in the game-winner, a walk-off single to centerfield to score Jazz Chisholm Jr.

Wells might be the happiest guy in the winning clubhouse after the Yankees still managed to prevail after he lost track of the number of outs while on second base in the bottom of the ninth with the score tied at 3.

He’d reached on a one-out single and moved to second when Trent Grishman unsuccessfully tried to bunt for a hit. But then he thought the inning was over, meandered off the base and ended up getting tagged for the second out in an inning-ending double play.

“He thought there were three outs,” manager Aaron Boone said. “Obviously, that can’t happen.”

“Just thought there [were] three outs,” Wells said. “Very embarrassed and disappointed for sure. You let the guys down when you do that. You give away an out like that in a big spot, so it’s disappointing.”

Tim Hill was supposed to have the night off but got drafted to pitch in the 11th inning and managed to keep the Rays off the board. In the bottom of the frame, Chisholm was the ghost runner and the Rays intentionally walked Jasson Dominguez to face McMahon. Tampa Bay reliever Kevin Kelly then balked the runners into scoring position and McMahon, who initially went up to bunt, delivered the game winner.

“It just feels good to come through,” McMahon said. “For the team, every win matters right now in this chase. . . . This is a very dangerous team, I’ve seen it playing from afar. . . plenty of times, they're never out of the game.”

“This group does a great job of playing,” Boone said. “Just keep playing . . . You’ve got to be able to withstand a mistake because the next play is just too important.”

The Yankees (59-49) remained four games behind the AL East-leading Blue Jays, who beat the Orioles. They will have a chance to take three of four from the Rays on Thursday afternoon when Marcus Stroman starts the series finale.

The Yankees shook off seven scoreless innings with just two hits and staged two comebacks before the final theatrics. The first comeback started in the eighth with Trent Grisham’s leadoff homer. They took a 2-1 lead on Giancarlo Stanton’s run-scoring flare single to center.

Williams needed to face just two hitters to see his string of 13 straight converted save opportunities come to an end. Junior Caminero battled back from a 1-and-2 count to draw a leadoff walk and Josh Lowe followed by driving a 2-and-0 changeup just inside the rightfield foul pole for a 391-foot two-run homer for a 3-2 Tampa Bay lead.

Then it was Rays closer Peter Fairbanks’ turn to blow a save. He gave up a one-out solo home run to Anthony Volpe, tying the game at 3 and redeeming the shortstop for committing his 16th error and third miscue in two games (which didn’t cost the Yankees a run but continued his fielding slump), but then Wells took them out of the inning.

Each team scored a run in the 10th, the Rays on a Jonathan Aranda sacrifice fly and the Yankees on a Cody Bellinger RBI triple to right with one out. The Aranda sacrifice fly came with the bases loaded and one out on a spectacular catch at the wall by Dominguez. And after Bellinger’s triple, the Yankees couldn’t get him home as Stanton struck out and Chisholm grounded out.

“[Dominguez] with a huge play there, leaping up on the fence for that ball,” Boone said. “That game [maybe] gets away right there.”

“Off the bat, in my mind, I just thought ‘you need to go get it — find a way to get to get that ball,’” Dominguez said. “When we started the season, I was struggling [in the field]. We [practiced] those plays, but as we are now, I'm able to make it.”

Hill retired the side in the top of the 11th, stranding the ghost runner, with the help of McMahon snaring a Josh Lowe line drive for the first out.

“It's one of those situations where the run usually scores,” Hill said, “so when you can hold it down, you feel pretty good about it.”

Yankees starter Will Warren went six strong innings and gave the lineup every opportunity over that span to grab a lead — which they didn’t.

Warren tied a season-high with 102 pitches in steamy conditions for six innings of one-run ball. He allowed six hits and one walk and struck out four. The righthander was lifted with the Yankees trailing 1-0.

Notes & quotes: Stanton did defensive drills in rightfield before the game, part of working his way up to potentially playing the outfield when Aaron Judge returns from the IL and will be restricted to designated hitter duties due to his strained right flexor . . . Luis Gil had no ill aftereffects from his minor league rehab start on Tuesday night and the 2024 AL Rookie of the Year, out since spring training with a lat strain, is on schedule to make his first start of the season Sunday against the Marlins in Miami.

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME