BOSTON — Gunnar Henderson and Jordan Westburg are the Orioles’ two youngest position players. Aaron Hicks and James McCann are their two oldest.

That quartet combined for five home runs, two by McCann, in a 13-12 victory over the Boston Red Sox, an offensive output that helped cover for another poor start from trade acquisition Jack Flaherty and a shaky night for the Orioles’ bullpen and defense. Baltimore allowed a season-high 23 hits, the first winning team to surrender that many in a nine-inning game since 1930.

“It was like a heavyweight boxing match,” said McCann, behind the plate for each of those nearly two dozen hits. “Every time we put up some runs, they found a way. We had the advantage of the homers and they found a way to shoot balls the other way, to find broken-bat base hits, find holes, infield singles, you name it. They did a good job of battling. Every time we threw a punch, they threw a punch, and thankfully we were able to come out on top.”

Ahead six entering the seventh-inning stretch, Baltimore’s relievers stranded multiple runners on base in each of the final three innings as a four-run lead entering the bottom of the ninth nearly vanished.

“Well, it wasn’t real comfortable,” manager Brandon Hyde said. “That was a straight grind-it-out, gut-check win.”

Winning their seventh straight game and series, the Orioles (90-51) reached the 90-win mark for the first time since 2014, the last time they won the AL East. Saturday’s victory at Fenway Park held their division lead on the Tampa Bay Rays at four games and dropped their magic number to clinch a playoff spot to six.

During each game of their winning streak, the Orioles have recorded double-digit hits, and nineof Saturday’s 14came from Henderson, Westburg, Hicks and McCann. The rookies are prized products of the Orioles’ rebuild, selected with their second pick in the 2019 and 2020 drafts, respectively. Baltimore got the two veterans off the relative scrap heap; the New York Yankees released Hicks amid his slow start to the season, and the New York Mets traded McCann to the Orioles this offseason for a low-level minor leaguer while eating most of the money left on his contract.

The foursome fueled the club’s 45th comeback victory. After a 1-hour, 32-minute pregame rain delay, Flaherty put Baltimore in an early 2-0 hole by allowing a first-inning home run on an inside curveball to Justin Turner, a pitch he has struggled with since arriving last month in a trade with the St. Louis Cardinals.

The Orioles got a run back in the second thanks to a double from Hicks, a single from Westburg and a throwing error from Boston shortstop Trevor Story. They went ahead with four runs in the fourth as Hicks followed an RBI double from Anthony Santander with a three-run home run, flipping his bat almost immediately after contact. Baltimore’s lead grew to 7-2 when the fourth began on a double by Westburg before McCann walloped a center-cut changeup from Chris Sale for a two-run homer.

“Obviously, winning makes it fun,” McCann said. “But just quality people and seeing the success that the young guys are having, the success the veteran guys are having, the success that one through nine is having with someone different every night, one through nine makes it a lot of fun.”

But Flaherty could not capitalize on the support. He opened the bottom of the fourth with a walk, then allowed two hits before a sacrifice fly that required a diving catch from left fielder Austin Hays chased him from the game after 3 1/3 innings. An error at third by Henderson resulted in two unearned runs, one credited to Flaherty and the other to reliever Cionel Pérez, that cut Baltimore’s lead to 7-6.

A pending free agent, Flaherty allowed a run over six innings in his first start for the Orioles after they traded three prospects Baseball America ranked among Baltimore’s top 20 — though all outside the top 10 — to St. Louis. He hasn’t made it through six frames in any of his five starts since, allowing 21 earned runs over 21 2/3 innings while allowing a batting line of .326/.393/.589.

“I can’t pitch any worse than I have,” an introspective Flaherty said. “It’s gonna get better. I’m gonna figure it out. Whatever adjustment needs to be made — it’s not about the work at this point. It’s not about the time in between. It’s not about any of that. It just comes down to execution, doing the little things right.

“Whatever anyone says, people have some things to say tonight, I’ll take it and remember those things and continue to work.”

Shintaro Fujinami inherited two runners from Pérez in the fifth and stranded both, covering first to prevent Boston (72-70) from tying the game as Westburg ranged far to his left at second to field a grounder. Retiring all five batters he faced to get the game through the sixth, Fujinami hasn’t allowed a run in eight of his past nine appearances with no walks in his past 11 outings; he walked nine batters and hit two more over his first 11 games with Baltimore after being traded from the Oakland Athletics as the Orioles’ lone bullpen addition ahead of the trade deadline.

“Fuji was absolutely fantastic,” Hyde said. “He’s on a little bit of a roll now. We love to see that because he’s got such great ability.”

After connecting with Fujinami, Westburg homered with one out in the fifth. In the next at-bat, McCann went deep again, the 10-year veteran’s second career multi-home run game coming on the three-year anniversary of his first.