BALTIMORE — The Baltimore Orioles’ offense is sputtering, and — not coincidentally — so is the team’s hope of overtaking first-place Boston in the AL East.

David Ortiz broke open a tight game with a three-run homer in the seventh inning, and the Red Sox beat Baltimore 5-2 Tuesday night for their sixth straight win.

The victory stretched Boston’s lead over third-place Baltimore to five games with 11 to play. Toronto is in second place, four games back following a 10-2 victory at Seattle.

After sweeping four games from the Yankees, the Red Sox have won the first two of this pivotal four-game series by identical scores.

“Two runs is not quite enough to go up against that offense,” Orioles catcher Matt Wieters said. “We know we need to do better and score more runs.”

Facing the highest-scoring team in the majors, Baltimore got only six hits against Eduardo Rodriguez (3-7) and four relievers.

“They’re pitching real well and we haven’t swung the bats real well,” manager Buck Showalter said.

Trey Mancini homered in his major league debut for the Orioles, who are 1 1/2 games ahead of Detroit for the second AL wild card.

The Red Sox are 11-3 in their last 14 games and a major league-best 13-5 in September.

“I think there is growing confidence in our clubhouse daily,” manager John Farrell said.

The Red Sox led 2-1 in the seventh when Marco Hernandez and Mookie Betts singled off Kevin Gausman (8-11). One out later, Ortiz hit a 1-2 pitch far over the center-field wall.

“I still can’t figure out how he can swing so hard on balls up and in and then cover a pitch down and away, but that’s why he’s the hitter he is,” Wieters said.

Ortiz guessed correctly that Gausman would throw a fastball.

“I had to shoot for something. Experience played out in that at-bat,” he said. “I told myself, ‘I’ve got to either shoot for a fastball or a splitter.’ But I know he’s throwing his best fastball right now. So I’m going to go for a fastball.”

Playing in his final season, Ortiz has 36 home runs and 121 RBIs. Big Papi has hit eight home runs against the Orioles this season — including two in this series — and 54 for his career.

Betts also extended his run of success against Baltimore, going 3 for 5 and scoring twice. He is 16 for 31 at Camden Yards and has scored 16 runs in eight games.

Rodriguez allowed two runs and four hits in 6 1/3 innings to earn his first win in 11 starts since July 16.

Craig Kimbrel worked the ninth for his 28th save.

After giving up four hits in eight scoreless innings last week at Boston, Gausman yielded five runs and 10 hits in 6 1/3 innings.

“I was just leaving a couple of pitches too good early on,” he said. “A team like this, it’s tough to repeat what I did in Boston.”

Boston went up 1-0 in the third when Betts singled and scored on a grounder by Hanley Ramirez. Jackie Bradley Jr. hit his 26th homer in the fourth.

Rodriguez retired his first 11 batters and held Baltimore without a hit until Mancini connected with two outs in the fifth. The rookie sprinted around the bases, taking about half the time Ortiz did during his home run trot in the seventh.

UNFORGETTTABLE MOMENT

The Orioles were quick to turn the page after the defeat, but Mancini will never forget this night. He became the third Orioles player to homer in his first game, following Larry Haney in 1966 and Jonathan Schoop in 2013.

“It was a really special moment, something that I’ve definitely been waiting for my whole life,” the rookie said.

TRAINER’S ROOM

Red Sox: Farrell gave 2B Dustin Pedroia (knee) the night off but expected him back in the lineup Wednesday.

Orioles: LHP Wade Miley is expected to leave the team after Sunday’s game against Arizona to join his wife, who is expecting. Showalter said the pitcher might miss the Toronto series that begins Tuesday.

UP NEXT

Red Sox: Clay Buchholz (7-10, 5.20 ERA) looks to extend a three-game winning streak Wednesday night. He is 0-2 with a 6.35 ERA against Baltimore this season.

Orioles: Unbeaten in four starts since Aug. 25, Ubaldo Jimenez (7-11, 5.94) is 2-5 with a 7.39 ERA lifetime against the Red Sox.