The Orioles will take this, no matter how wonky it ended. The bobble at shortstop, the stumble and fall in left field — this took a collapse, literally, for Baltimore to come back from a collapse of its own.

With two outs in the ninth inning, one run scored on what looked to be a sure-fire third out. But Anthony Volpe bobbled the exchange, giving the Orioles life. And, with bases loaded shortly after, Alex Verdugo fell flat when trying to chase down Cedric Mullins’ line drive.

With the 6-5 win, the Orioles buck a five-game losing streak and end the first half with a one-game lead over the New York Yankees in the American League East. It wasn’t pretty, but after the recent slide, pretty isn’t required.

“That just shows the grit we have on this team, even after losing five straight,” Gunnar Henderson said. “To come back and do that in the ninth in that fashion was pretty awesome.”

The Baltimore Banner thanks its sponsors. Become one.

The celebration that ensued seemed to expel some of the built-up tension in real time. Mullins slammed his helmet. Colton Cowser was the first player to greet Mullins, doing so with a shoulder bump. Anthony Santander carried the Gatorade cooler all the way to second base, doused Mullins and then screamed as he jumped around.

It was possible because of Verdugo’s poor read. The ball from Mullins had an expected batting average of .150, according to Statcast, and Verdugo’s catch probability was 99%. But Verdugo ran in, then scrambled back, then laid in a heap as the Orioles celebrated.

“As soon as I saw him take a step in,” Mullins said, “I figured he got a bad jump on it and had a feeling he was burnt.”

But all of that was required because of right-hander Craig Kimbrel’s disastrous ninth inning. Baltimore entered the ninth with a one-run lead. The Orioles had plenty of chances to add on, but as has been the case so frequently of late, they fell away unobtained, and Kimbrel took the mound.

Walk. Walk. Three-run home run.

The Baltimore Banner thanks its sponsors. Become one.

The damage was done swiftly in the ninth inning — three straight batters reaching base and then scoring against the right-hander with the fourth-most saves of any pitcher in major league history. Ben Rice unleashed on a four-seam fastball from Kimbrel that doesn’t have the life it once did, and the Yankees were three outs from sealing a sweep.

“I didn’t do my job today and the guys had my back and we got a W,” Kimbrel said. “It’s huge. Extremely lucky. I’ve blown — I don’t know what the number is so far this year [five], but the number of saves that I’ve blown, our guys have been able to come back and capitalize. Make it not hurt so bad, and I couldn’t be happier.”

Right-hander Clay Holmes, however, walked two and allowed two hits and three unearned runs. He would’ve gotten out of it had Volpe not made an error on a routine grounder or Verdugo not slipped.

“Volpe is a really good player, and you’d expect a ground ball hit to him, you’d probably be out,” manager Brandon Hyde said.

With Mullins’ double, the Orioles are now hitting 2-for-39 with runners in scoring position since Tuesday, when the skid began. They finished Sunday 1-for-8 in those situations Sunday, needing an assist.

The Baltimore Banner thanks its sponsors. Become one.

In the second, the misfortune seemed to really sink in when Cowser’s soft liner that appeared destined for center field with two runners in scoring position was instead snared by a lunging Volpe at shortstop. James McCann popped out and Henderson struck out to strand two runners in the fourth. Mullins, pinch runner for Santander after an eighth-inning triple, was out at the plate on a fielder’s choice.

Still, Baltimore entered the ninth inning with a lead because of powerful swings from Henderson and Santander. Henderson launched his 28th homer of the year, a two-run shot, and Santander thundered his 11th career Eutaw Street home run — which is tied with Chris Davis for the most in Oriole Park history.

Baltimore had a lead because of its pitching staff before Kimbrel.

Anthony Santander hit the 11th Eutaw Street home run of his career in the fifth inning. (Nick Wass/AP)

Twice Trent Grisham got the better of right-hander Dean Kremer. The Yankees outfielder, who entered with a .173 average, put New York ahead in the second inning with a single to score Volpe, who had doubled. And in the fifth, once Kremer had largely settled back in, Grisham struck again.

Kremer fell behind 3-0 in the count, then tried to sneak a second four-seam fastball over the plate for a second strike. Grisham watched the first, then pounced on the second, lifting it to right field for a game-tying solo homer.

The Baltimore Banner thanks its sponsors. Become one.

With the All-Star break looming, Hyde could afford to be aggressive with his bullpen usage. He pulled Kremer once two more batters reached in the fifth, when in other circumstances Kremer might’ve had a longer leash.

“It’s been a really tough week in a lot of ways,” Hyde said. “There was definitely a different sense in the dugout today and a little bit more playoff-like. ... We really wanted to get this one.”

The bullpen pieced together the remainder of the game with aplomb, beginning with right-hander Jacob Webb stranding the two inherited runners to conclude the fifth. Left-hander Cionel Pérez followed and punched out Juan Soto with a slider on the outside edge of the strike zone — a pitch that so froze Soto that the slugger nodded his head to Pérez on his walk to the dugout, giving credit where it was due.

Right-hander Yennier Cano pitched a scoreless 1 1/3 innings before Kimbrel’s blown save. For a moment, it appeared as though the Orioles were headed for a sixth straight loss. Then the chaos of the bottom of the ninth unfolded.

One win doesn’t change the nature of the Orioles’ slump, which extends beyond this homestand and includes a sub-.500 record over the last 21 games. But it’s a respite going into the All-Star break.

“Been a tough week, and it was huge to get a win just to go into the break,” Hyde said. “These guys definitely need a break.”