BOSTON — Nelson Cruz went a career-best 5 for 5, including a solo home run and a bad-hop single that scored the go-ahead run in the sixth inning, and the Baltimore Orioles beat the Boston Red Sox 7-4 to earn a split of a day-night doubleheader on Saturday.

The Red Sox won the opener 3-2 on Jonathan Herrera’s one-out, broken-bat RBI single off T.J. McFarland in the bottom of the ninth.

In the nightcap, Cruz had two doubles and was thrown out at third in an attempt for the cycle in the eighth. Nick Hundley added a two-run homer as Baltimore overcame Boston starter John Lackey’s 11 strikeouts over 52/3 innings.

Stephen Drew homered in both games for the Red Sox, who have lost 4 of 5. Drew hadn’t homered since Boston’s World Series clinching Game 6 win in October.

In the opener, Herrera’s first career walk-off hit gave Boston the victory.

“I was ready. I was taking some swings in the cage,” said Herrera. “I was ready for that at-bat.”

After Jon Lester’s masterful eight-inning outing resulted in only a 2-2 tie, closer Koji Uehara (4-2) pitched a perfect ninth before Manager John Farrell went to his bench.

Pinch-hitter Jonny Gomes legged out a leadoff infield single off reliever McFarland (1-2). David Ross then bunted Gomes to second before Herrera, hitting for Jackie Bradley Jr., sent a blooper to right that scored a sliding Gomes and snapped Baltimore’s four-game winning streak.

“He broke the bat in half. Mac’s throwing the ball,” Orioles Manager Buck Showalter said. “We didn’t have many options there. Mac was our best option.”

Lester gave up two unearned runs, struck out seven and walked none while being denied his 10th win.

“Sometimes, for me, Jonny can get a little rattled. He didn’t today,” Ross said.

“He really kept his poise. We didn’t play really good behind him. He kept his poise and was a real mature starter today with great stuff.”

The Orioles’ two runs came on Xander Bogaert’s two-out error in the third inning of a game being made up after Friday’s game was rained out.

Bogaerts was booed then and later when he struck out three times in an 0-for-4 outing that left him hitless in 27 at-bats. A.J. Pierzynski, filling in at DH with David Ortiz missing the first game to attend his daughter’s graduation, heard it from the fans with four infield pop outs. But Lester kept Boston in it as he lowered his ERA to 2.73 in what’s been the best year of his career as the lefty heads into possible free agency in the offseason.

“Judging by today, I don’t think it was much of a distraction,” said Lester, adding that he didn’t believe contract talks would reopen soon. “I think both sides, right now, are happy with not talking right now.”

Baltimore, which entered the day in first place in the AL East, got a good starting pitching performance from Miguel Gonzalez.

The right-hander, who had struggled in his previous three starts since returning from an oblique injury, allowed two runs and seven hits, striking out six with two walks in eight innings.

NOTES: Boston second baseman Dustin Pedroia’s bad throw in the third was his first error since April 24. … Farrell said Shane Victorino (hamstring, back) could begin another rehabilitation assignment in a few days.