BALTIMORE — As the AL East race heads into September, the Baltimore Orioles aren’t playing like a last-place team anymore and the Boston Red Sox no longer have the look of a contender.

Rookie Brian Matusz won his third consecutive start, and the Baltimore Orioles beat Josh Beckett and the fading Red Sox 5-2 on Tuesday night to cap a memorable first month under Manager Buck Showalter.

Luke Scott hit his career-high 26th homer, had two RBI and scored twice to help the Orioles extend their winning streak to four. Baltimore went 17-11 in August, 17-10 with Showalter in the dugout.

“It’s been fun, what can you say? We are getting pitching, we are getting defense and we are getting offense,” right fielder Nick Markakis said. “When you get all three of those, good things happen.”

The Orioles last had a winning August in 1997 — the most recent season in which they finished above .500.

“The positive thing is we are doing it against teams that we have struggled with in the past,” Markakis said.

Baltimore went 6-0 against the Los Angeles Angels in August and finished the month by beating Boston. The Orioles were 4-24 against those teams last year.

Matusz (7-12) allowed two runs, six hits and a walk in six-plus innings. The left-hander struck out six, including David Ortiz three times.

Koji Uehara, the third Baltimore reliever, retired all five batters he faced to earn his fifth save.

Jed Lowrie homered for the Red Sox, who have dropped three straight. Boston fell eight games behind AL East-leader New York and remained seven games behind wild-card-leading Tampa Bay.

“We’ve got to win games,” Lowrie said. “We don’t have any other choice.”

Lowrie was one of few players to make himself available in the sullen Boston clubhouse. Beckett left by the time reporters were allowed to enter and Ortiz refused to talk.

Beckett (4-4), who came in with a 6.50 ERA, gave up three runs, two earned, and seven hits in seven innings.

“We expect that from Beckett,” Manager Terry Francona said. “We’ve come for a long time to lean on him. Tonight was more what he can do.”

Baltimore got a first-inning run when Markakis doubled and scored on a single by Scott, who ended a 2 for 21 slump. Markakis became the first player in Orioles history to hit 40 doubles in four successive seasons.

“It’s definitely something to be excited about,” he said. “You’re going to have your struggles, but it’s always good to get something like that.”

It became 3-0 in the third. With runners on the corners and two outs, Adam Jones hit a grounder in the hole to shortstop Marco Scutaro, who threw wildly to second.

Jones was credited with an RBI single, and another run scored while right fielder J.D. Drew retrieved the ball.

Lowrie ended Baltimore’s run of 30 straight scoreless innings in the fifth, hitting his fourth homer following a leadoff single by Mike Lowell. It was only the third home run allowed by Matusz in his last seven starts.

The Red Sox got runners at first and third with two outs in the sixth before Lowell looked at a third strike.

Scott and Felix Pie both hit solo shots off Felix Doubront in the eighth.