Updated

Manny Machado launched a three-run homer to cap a five-run ninth inning, as the Baltimore Orioles rallied to beat the Boston Red Sox, 8-5, at Fenway Park.

Joel Hanrahan (0-1) was tasked with getting the final three outs for Boston, which carried a 5-3 lead into the ninth.

Chris Davis opened the frame with a solo home run to center field. Hanrahan, who was looking to nail down his 100th career save, retired the next two batters before everything unraveled.

Ryan Flaherty singled and consecutive walks to Nolan Reimold and Nate McLouth loaded the bases. The tying run scored on a wild pitch and Machado put Baltimore in front with his drive off Hanrahan to the Green Monster seats.

"You've got your closer in the game, the ballgame locked up, it's tough," Red Sox catcher Jarrod Saltalamacchia said. "But I still feel that Joel's got some of the best stuff I've ever caught."

Boston went 1-2-3 in the bottom of the ninth, with Jim Johnson earning his third save of the season. Darren O'Day (1-0) was awarded the victory after pitching a perfect bottom of the eighth.

Both starting pitchers, Baltimore's Jake Arrieta and Boston right-hander Ryan Dempster, didn't return when rain halted play at the conclusion of the fifth inning.

After a 43-minute delay, the Red Sox broke a 3-3 tie with consecutive two-out home runs by Daniel Nava and Saltalamacchia in the sixth.

The Orioles got a run in the first inning without the benefit of a hit.

McLouth walked to begin the game and reached third when miscommunication between Jacoby Ellsbury and Shane Victorino led to Machado's fly ball dropping in for a two-base error. McLouth then scored on a groundout by Nick Markakis, but Dempster avoided further damage by striking out Adam Jones and Davis.

Boston tied things up in the second and pushed two more runs across in the third to take a 3-1 lead.

Nava kept the second alive with a two-out walk and came home when Saltalamacchia doubled off the Green Monster. Stephen Drew, making his Red Sox debut at shortstop, flied out to end the inning.

Drew was activated from the seven-day disabled list before Wednesday's game. He suffered a concussion after being hit on the helmet by a pitch on March 7.

Rookie Jackie Bradley led off the third with a walk and Ellsbury hit a ball the opposite way past a diving McLouth in left field for triple. Victorino's sacrifice fly to left plated Ellsbury.

Baltimore, however, pulled even with two runs in the fourth.

The O's were hitless until Markakis took Dempster deep to right-center to open the frame.

A second Boston defensive misplay then led to the tying run. Jones followed Markakis' blast with a single, took second on a wild pitch and hustled home after Bradley couldn't cleanly field Matt Wieters' single to left.

The Red Sox hadn't committed an error in their first seven games of 2013, a club record to begin a season.

"It was a huge win for us," Machado said. "To come out with the victory is just going to give us the big boost that we needed to get this show rolling."

Game Notes

Wednesday marked the end of Boston's sellout streak at 794 regular-season games. Including postseason games, the run, which started May 15, 2003, spanned 820 games. Both the regular-season and overall streaks are the longest in major professional sports ... The Red Sox placed starting pitcher John Lackey on the 15-day disabled list with a right biceps strain and recalled pitcher Alex Wilson from Triple-A Pawtucket ... To make room for Drew, the Red Sox optioned shortstop Jose Iglesias to Pawtucket ... The Orioles traded reliever Luis Ayala to the Atlanta Braves in exchange for pitcher Chris Jones, who was assigned to Double-A Bowie.