BALTIMORE -- Down by three runs in the sixth inning, the Boston Red Sox desperately needed a spark to get back into the game against the Baltimore Orioles.

With one mighty swing, David Ortiz launched a ball out of Camden Yards and sent the Red Sox on their way to an uplifting 8-6 victory Monday night.

Dustin Pedroia had two RBIs and Mike Aviles scored the go-ahead run in the seventh to help Boston secure its ninth win in 11 games. The Red Sox are tied with the New York Yankees in the AL East cellar but are at .500 (21-21) for the first time since April 30.

"It's definitely not a goal, but it's better than being under .500," manager Bobby Valentine said.

Boston trailed 5-2 in the sixth before Ortiz hit a drive that was so obviously gone that right fielder Nick Markakis didn't even turn around to see it become the 62nd homer in the 21-year history of Camden Yards to land on Eutaw Street.

It was his 10th homer of the season, second in three games, and the timing could not have been better.

"We start the rally afterward," Ortiz said. "Somebody got to start it, right?"

Adrian Gonzalez followed with a double and Daniel Nava hit a sacrifice fly before starter Tommy Hunter balked in a run to tie it, and the Red Sox were on their way.

"We hit a couple of balls good early, but nothing like that," Pedroia said. "That definitely jump-starts your offense and makes you feel like we can get to them."

Hunter lamented the balk, but acknowledged that Ortiz had the most telling hit.

"The last inning was very frustrating," he said. "I left the ball up to Ortiz. He pimped the (stuffing) out of the ball."

Chris Davis homered for the first-place Orioles, who swept a three-game series in Fenway Park earlier this month. It was the first meeting between the teams in Baltimore since the Orioles ruined Boston's chances of reaching the playoffs with a walkoff win on the final day of the 2011 regular season.

"Yeah, it's a tough one to lose, but there's always positive things we can take away from the game," Davis said. "We swung the bats really well tonight, made some good plays defensively. Just couldn't hang in there."

The Red Sox went up 7-5 in the seventh against Kevin Gregg (2-2). Aviles hit a one-out single and took third on a double by Pedroia before Ortiz received an intentional walk to load the bases. Gonzalez followed with a sacrifice fly and Will Middlebrooks added an RBI single, one of his three hits for the night.

Pedroia singled in a run in the eighth for a three-run lead.

In the bottom half, Matt Wieters snapped an 0-for-20 skid with an RBI single off Rich Hill, whose run of eight straight hitless outings ended. But with runners at second and third and one out, Vicente Padilla retired Wilson Betemit on a short fly and struck out Nick Johnson. Padilla has stranded all 15 inherited runners this year.

Alfredo Aceves worked the ninth for his 10th save.

After Boston starter Clay Buchholz gave up five runs in 5 1/3 innings, Andrew Miller (1-0) retired all five batters he faced to earn the win on his 27th birthday.

Boston used a run-scoring single by Aviles and Pedroia's sacrifice fly to go up 2-0 in the third.

Baltimore answered with four runs in the bottom half despite hitting only one ball out of the infield. After Betemit singled to right, a walk and Robert Andino's bunt single loaded the bases. Buchholz then walked in a run, gave up an infield single and issued another bases-loaded walk. The final run came in when Adam Jones hit into a 6-4-3 double play.

Davis hit his sixth home run, the first in three weeks, to make it 5-2 in the fourth.

Two innings later, Ortiz took over.

"We got a lead and we gave it up and we weren't going to be denied," Valentine said. "I thought David's home run really uplifted us. It was such a power stroke."

Game notes

Boston OF Cody Ross has a fractured bone in his left foot and could miss 6-8 weeks, GM Ben Cherington said. Ross is expected to be placed on the DL on Tuesday. ... Orioles 2B Brian Roberts, who's been sidelined since May 2011 with a concussion, said Monday he could begin a minor league rehabilitation assignment within a few weeks. Roberts has been taking batting practice and fielding grounders, but said, "The biggest key is to start getting real at-bats in a real atmosphere." ... The pitching matchups for Tuesday night: Boston's Felix Doubront (4-1) against Brian Matusz (3-4). ... Jones extended his hitting streak to 13 games, tying a career high.