BALTIMORE — The Baltimore Orioles’ powerful lineup is capable of breaking open a game at any moment, especially in the hitter-friendly confines at Camden Yards.

When they get effective starting pitching, the Orioles are simply going to be a tough team to beat.

Wade Miley allowed one run over seven innings, Mark Trumbo hit the first of four home runs off Eduardo Rodriguez, and Baltimore beat the Boston Red Sox 7-5 on Thursday night.

“You’re going to have to score runs in our division,” Orioles manager Buck Showalter said.

After scuffling through a seven-game losing streak, Baltimore won three of four against American League East rivals. The Thursday contest was the opener of a four-game series.

The Red Sox (29-24) lost for only the third time in 11 games, and they are still a half-game ahead of the Orioles (28-24) in the standings.

Chris Davis and Adam Jones homered for the second straight night. Jonathan Schoop hit a three-run shot in the sixth that gave Baltimore a 7-1 lead.

Miley (2-3) had one of his best outings of the season. He scattered five hits and one walk while striking out three, lowering his ERA to 2.82. He also picked up his first win at Camden Yards in five starts this season.

“Everybody knows what this offense is capable of doing,” Miley said. “It definitely takes a lot of pressure off the pitching staff but we still have to go out and do our jobs. That’s when you get on a roll, when the pitchers are pitching good and we’re swinging the bats like we’re swinging right now. I mean, the opportunity is there.”

Rodriguez (4-2), a former Orioles prospect, took his first loss since April 8. He allowed seven runs on eight hits, both season highs, with six strikeouts and no walks over 5 2/3 innings. Rodriguez slipped in the bullpen warming up before the game. However, he said that did not affect his performance.

“I just missed my pitches,” Rodriguez said. “With those guys, when you miss, that will happen. They make contact and hit homers.”

Christian Vasquez had two hits and two RBIs for the Red Sox. He is batting .348 in 29 games. Jackie Bradley Jr. hit a two-out, three-run homer in the ninth off Donnie Hart to pull Boston to 7-5, but Pablo Sandoval grounded out to end the game.

Baltimore improved to 18-8 at Camden Yards — the best home mark in the American League.

Orioles third baseman Manny Machado snapped an 0-for-18 skid with a single in the first inning. Trumbo, who had three hits, followed with a two-run shot to left off Rodriguez.

“I think the pitches we got to hit, we did a good job of putting in play,” Trumbo said. “He got a lot of weak contact, and he mixes up really well. I think the mistakes that we did get, we were in position to do something with them.”

The Red Sox cut the margin to 2-1 on a Vazquez RBI single in the second.

Davis boosted the lead to 3-1 when he led off the fourth with a solo homer to straightaway center. He was the first left-handed batter to hit a home run off Rodriguez since July 16, 2016.

“In this game, it’s always good to have a short memory, and yet go back to executing the quality locations,” Red Sox manager John Farrell said. “I thought tonight there was a pitch that ended up down and in to Trumbo in the first inning. Those are some things that haven’t been there in the six or seven starts previous.”

NOTES: Red Sox 2B Dustin Pedroia (left wrist sprain) has done some cardio and continues to improve. “Some of that swelling is reducing quite a bit, and the range of motion is starting to get there,” manager John Farrell said. … Baltimore C Welington Castillo, on the 10-day disabled list after sustaining a testicular injury Tuesday night on a deflected pitch, will not be able to do any rehab for at least another three or four days. “It’s not an easy conversation other than how you’re feeling,” manager Buck Showalter said. … Red Sox LHP Robbie Ross Jr. (left elbow inflammation) had his option to Triple-A Patuxent reversed and was placed on the major league DL.