BOSTON -- Manny Machado was only fairly certain his blast to left field was going to clear Boston's Green Monster.
His teammates on the Baltimore bench were much less skeptical as Machado's three-run shot capped a five-run rally in the ninth inning, as the Orioles ended a four-game skid by beating the Boston Red Sox 8-5 on Wednesday night.
"That was pretty special," said Ryan Flaherty, who singled with two out in the ninth with the O's trailing 5-4. "It was huge. It was kind of a team inning and it was good."
Chris Davis led off the inning with homer to center off of closer Joel Hanrahan (0-1), whose attempt at his second save of the season unraveled in disaster.
Flaherty, who entered the game 0 for 14 and struck out in his first three at bats, came through with his first hit of the year. Hanrahan loaded the bases by walking Nolan Reimold and Nate McLouth, then threw a slider in the dirt on his first pitch to Machado, allowing the tying run to score.
Machado blasted the next pitch he saw for a homer to left, clearing the bases and giving the Orioles an 8-5 lead in a game they were one strike away from losing.
"You never know with that wall out there," Machado said. "I was just looking for something to hit. Something good, something nice and hard. He threw me a fastball and I was sitting on it."
Darren O'Day (1-0) got the win and Jim Johnson got his third save of the season for the Orioles, who hadn't won since April 5.
Daniel Nava and Jarrod Saltalamacchia hit back-to-back homers in the sixth to break a 3-all tie after a 43-minute rain delay following the fifth inning. The Red Sox bullpen pitched three scoreless innings before calling on Hanrahan to finish off the Orioles.
"You got your closer in the game, the ballgame locked up. It's tough," Saltalamacchia said. "Even when he misses, usually they go by people. Tonight just wasn't his night, but nine times out of 10 I guarantee you he'll close the door and we're going to count on that."
Nick Markakis also homered for Baltimore in the game, which marked the official end to the Red Sox' consecutive sellout streak of 820 games, including playoffs. Nava homered for the third straight game, two nights after hitting a three-run shot in the seventh in Boston's 3-1 win Monday in the series opener.
"We'll get a chance to savor it from here to about the time we get to the hotel, then we've got to do it again ... and again ... and again," Baltimore manager Buck Showalter said. "We don't pay attention to how many we won by or lost by."
Ryan Dempster was strong in his Fenway Park debut for the Red Sox, striking out seven and holding Baltimore to three hits in five innings. Markakis' leadoff homer in the fourth was the only earned run allowed by Dempster.
Baltimore starter Jake Arrieta also did not return after the rain delay. He was replaced by Tommy Hunter, who started the sixth with two quick strike outs before facing Nava and Saltalamacchia. Nava drove a 1-1 pitch over the Green Monster to break a 3-all tie. Hunter had a 1-2 count on Saltalamacchia before the Boston catcher hit a shot to right for his first homer of the year.
Jacoby Ellsbury hit an RBI triple in the first and Shane Victorino drove in a run with a sacrifice fly, but his run of reaching base in every game as a member of the Red Sox ended at seven straight games.
Baltimore's Adam Jones extended his hitting streak to nine straight games, dating back to last season, despite striking out three times.
The rain picked up in the fifth and the umpires sent everybody to the clubhouse after the inning with the score tied at 3.
Saltalamacchia hit an RBI double for Boston to tie it at 1-1 in the second, then Ellsbury hit an RBI triple in the third and scored on Victorino's sacrifice fly to put Boston up 3-1.
Markakis led off the fourth with a homer to Boston's bullpen, and the Orioles tacked on another run on an error by right fielder Jackie Bradley Jr. to tie it.
NOTES: Jones singled to center in the fourth, giving him at least one hit in all eight of Baltimore's games this season. ... Markakis' homer to lead off the fourth gave him at least one hit in seven of eight games. ... The Orioles entered the game at 3-4, their first losing record since ending the 2011 season 69-93. ... Boston's Stephen Drew was activated from the disabled list Wednesday after missing the start of the season with a concussion. He started at shortstop. ... To make room for Drew on the roster, the Red Sox optioned SS Jose Iglesias to Triple-A Pawtucket. ... The Red Sox also placed RHP John Lackey on the 15-day DL with a strained right biceps. Lackey missed last season while recovering from Tommy John surgery on his right elbow. ... The Red Sox' streak of 820 consecutive sellouts is now the longest in Major League history. ... The Red Sox held a moment of silence before the game in memory of longtime Boston AP sports writer Dave O'Hara, who died Wednesday at age 86. ... The series concludes Thursday when Baltimore's Chris Tilman (0-0) faces Alfredo Aceves (0-0)in a battle of right-handers both seeking their first win of the season.