BOSTON — Midway through the nightcap of their twin bill against the Red Sox on Saturday, the Orioles were in danger of dropping the doubleheader and losing their hold on first place in the American League East.

But after a 7-4 win over the Red Sox in which the Orioles came from behind to score five unanswered runs and shut down Boston with 5 1/3 strong innings from the bullpen, the music blasted inside the visiting clubhouse at Fenway Park.

Earning a split of their day-night doubleheader was, in a way, a victory. They had lost the series opener earlier Saturday on a walk-off hit after eight innings from right-hander Miguel Gonzalez, and right-hander Ubaldo Jimenez had been chased from Game 2 after just 3 2/3 innings, his second-shortest start as an Oriole.

But these newly minted first-place Orioles proved resilient.

“It's something they've been doing, really for three years,” Orioles manager Buck Showalter said. “It's the grind of the season. You have to earn everything up here. That's why there are no Cinderellas in baseball. We play too many games, and the schedule is crazy at times. It takes a lot of discipline on and off the field to do this.”

Nelson Cruz likely will be voted to start in the All-Star Game for the first time in his career Sunday because of his power numbers. But in the clubhouse after the game, all the talk was about Cruz's unsuccessful attempt to leg out a triple to complete the cycle.

Cruz recorded a career-high five hits in the win and tied Chicago's Jose Abreu for the major league lead with his 27th homer of the season. In his final at-bat, in the eighth, Cruz hit a ball over Daniel Nava's head in right field. The 230-pound Cruz chugged around second, full steam, and slid headfirst into third, but the cutoff throw beat him there.

“As soon as I saw it went over his head, I was like, ‘I got to take a shot [and] see what happens,' “ Cruz said. “I think my angle from first … was bad. So I had to go a long ways to second. I'm happy we won. … Just try, you know? Just try and see what happens. I don't remember the last time I hit a triple. I know I tried one last year and got thrown out at third. That's why I don't try.”

Said Showalter: “If you can't enjoy that and take it the way you need, you're taking yourself way too seriously.”

Trailing 4-3 heading into the sixth inning, the Orioles batted around and plated four runs. Steve Pearce tied the game with an RBI single to center field, the first of three straight run-scoring singles off Boston reliever Burke Badenhop.

Adam Jones and Cruz followed with RBI singles of their own, and the Orioles scored a fourth run on shortstop J.J. Hardy's forceout grounder to third with the bases loaded.

The Orioles (47-40) got home runs from catcher Nick Hundley and Cruz, their seventh multihomer game in the past nine. Hundley hit a two-run shot in the fourth to give the Orioles a 2-0 lead, and Cruz hit a solo blast in the fifth that cleared the Green Monster in left.

Cruz's five-hit night was the Orioles' first in a nine-inning game since Nick Markakis had five July 3, 2011, against the Atlanta Braves. Hardy had five hits in a 17-inning game in Boston on May 6, 2012.

Red Sox shortstop Stephen Drew, who hadn't hit a home run in his previous 66 at-bats and was hitting .136, hit homers in both games, including a two-run shot in the nightcap that fueled a four-run fourth inning against Jimenez.

Jimenez's six walks tied a season high, but his first five didn't lead to any runs, and he didn't allow a hit until the fifth.

The walks “hurt me a lot because every time I got on the mound, I had runners on base,” Jimenez said. “Basically, I beat myself by walking guys. You never put yourself in a good position when you start walking guys.”

The first hit he allowed was Drew's two-run homer to right field, which came after Jimenez issued a leadoff walk to Mike Napoli.

After he struck out Jonny Gomes, four consecutive Red Sox batters had hits, including a run-scoring, two-out double by Brock Holt and Daniel Nava's subsequent RBI single.

Jimenez has struggled mightily against the Red Sox, going 1-4 with a 9.37 ERA in seven career starts. He also has issued five or more walks in five of his past six starts.

Red Sox starter John Lackey recorded 11 strikeouts in 5 1/3 innings and left the game leading 4-3 with two on and one out before Pearce tied the game with his RBI single.

Once Jimenez was chased from the game in the fourth, the Orioles' bullpen kept the Red Sox (39-48) in check — manager Buck Showalter had saved most of his relievers for the nightcap — as five relievers combined to allow just one hit.

“That's the job they've been doing every day,” Jimenez said of the bullpen. “Those guys, once they get on the mound, they're going to be out there pounding the strike zone and closing the door. That was a really awesome job.”

Right-hander Brad Brach, the right-handed long-relief arm brought in to replace Jimenez, earned the win with 1 1/3 scoreless innings. Left-hander Zach Britton tossed a perfect ninth for his 13th save in 15 opportunities.

The Orioles lost the first game of the day, 3-2, a defeat that ended their four-game winning streak after pinch hitter Jonathan Herrera's walk-off single in the bottom of the ninth.

Gonzalez recorded arguably his best start of the season in the game, tying his career high with eight innings and allowing just two runs and seven hits — this after needing 43 pitches to get through his first two innings. Tommy Hunter tossed 1 2/3 perfect innings, left-hander Brian Matusz retired David Ortiz to end the seventh, and Darren O'Day struck out two in a perfect eighth.

The Orioles went into the ninth tied at 2 before left-hander T.J. McFarland — who had allowed just one run over 15 2/3 innings in June — allowed the game-winning, broken-bat single to Herrera with one out in the bottom of the ninth.

As Herrera swung at a 1-0 fastball, the barrel of his bat twirled one way as the ball looped just over second baseman Jonathan Schoop's glove and into shallow right-center field to score Jonny Gomes from second.

“What are you going to do?” Showalter said. “I was real proud of the pitchers today, especially Miggy.”

The Red Sox by no means battered McFarland. Brought into the game in the ninth to face two left-handed batters due up that inning, he instead ended up facing three right-handers. Gomes, a pinch hitter, opened the inning with an infield single that Hardy backhanded deep in the hole at shortstop but couldn't get to first in time.

David Ross then dropped a bunt that catcher Caleb Joseph corralled and considered throwing to second before settling for the sure out at first.

Herrera, a switch hitter, then sent the Orioles off the field with his walk-off hit. Jones' throw home was high and wide as Gomes slid home into a Red Sox celebration at home plate.

The Orioles scored just two unearned runs off Boston left-hander Jon Lester in eight innings, managing five hits on the day. They went quietly in the top of the ninth as former Oriole Koji Uehara struck out Jones and Chris Davis in a perfect frame.

Gonzalez kept Boston's bats at bay throughout the afternoon. After allowing two runs in the second inning, Gonzalez retired 14 of the next 15 batters he faced.

As Gonzalez's pitch count crept toward triple digits, Showalter stuck with him in the eighth, and the right-hander stranded two runners in scoring position after throwing his season-high 113th pitch of the day, one shy of his career high. He last threw eight innings June 11, 2013, against the Los Angeles Angels.

With two runners in scoring position in the eighth, Gonzalez struck out Xander Bogaerts looking on a 2-2, split-finger fastball to end the inning.

“That's the kind of Miggy we're going to need,” Showalter said. “He was solid. I thought he deserved a chance to finish off that eighth inning. He had some real low-duress innings. He was solid.”

Gonzalez has posted quality starts in all four of his career starts against the Red Sox, and is 3-0 with a 2.90 ERA in six career appearances against Boston.

eencina@baltsun.com

twitter.com/EddieInTheYard