BALTIMORE (AP) -- Jemile Weeks hit an RBI single to give Oakland the lead during a six-run ninth inning against All-Star closer Jim Johnson, and the Athletics beat the Baltimore Orioles 14-9 on Friday night in a back-and-forth duel that featured 31 hits and lasted four hours.
The Athletics led 5-0 in the second inning and 8-6 in the eighth, yet fell behind on each occasion before rallying back.
After Baltimore scored three runs in the eighth to go up 9-8, Oakland pounded Johnson (1-1) for six runs on six hits and a walk in the ninth. The Orioles fell to 41-1 when leading after eight innings.
Chris Carter and Brandon Hicks homered for the A's, who have won 12 of 14, and Seth Smith tied a career high with five RBIs.
Johnson got the first out in the ninth before Carter and Brandon Inge singled. Derek Norris tied it with a bad-hop single and, after a walk to Brandon Moss, Weeks put Oakland in front for good with a single to left. Coco Crisp followed with a two-run single and Smith doubled in two runs.
Jerry Blevins (4-0) was given credit for the win by the official scorer because Oakland closer Ryan Cook was ineffective in the eighth.
Adam Jones and Chris Davis homered and J.J. Hardy had three RBIs for the Orioles, who have lost four of five.
Baltimore overcame a 5-0 deficit to take a 6-5 lead in the fifth, then fell behind 8-6 before moving in front in the eighth against an Oakland bullpen that was 7-0 with a 1.96 ERA since the All-Star break.
After walking Mark Reynolds to open the eighth, Sean Doolittle got two straight outs before Nick Markakis singled. Cook then gave up an RBI single to Hardy and went to 0-2 on Jim Thome before yielding the game-tying single. Cook hit Jones with a pitch before Davis lined a single to left to bring home Hardy.
Thome was thrown out at the plate on a play that wasn't even close. The decision to send the 41-year-old was questionable, but Oakland's big ninth inning lessened its significance.
Baltimore used a four-run fifth inning to take a 6-5 lead against rookie Jarrod Parker. After singles by Taylor Teagarden, Markakis and Hardy produced a run, Thome struck out. But Jones hit the next pitch into the front row of the seats in left to put the Orioles ahead for the first time.
Oakland answered immediately in the sixth.
Orioles starter Zach Britton was lifted in the sixth after walking Brandon Hicks with one out. Right-hander Miguel Socolovich, recalled from Triple-A Norfolk before the game, walked two straight batters to load the bases for pinch-hitter Smith, who fought back from an 0-2 count to hit a 3-2 pitch into the gap in left-center for an 8-6 lead.
Early on, the Athletics appeared poised for easy victory.
Britton opened the game by striking out Coco Crisp, but Oakland's next four players reached base and scored. Jonny Gomes walked and came home on a triple by Josh Reddick, who scored on a wild pitch. Yoenis Cespedes then singled and Carter followed with his seventh home run.
Hicks homered on Britton's first pitch of the second inning to end a 5-for-39 slump, and Davis connected in the bottom half. Twelve of his 19 home runs have come at home.
Baltimore closed to 5-2 in the third when Markakis drew a two-out walk and Hardy doubled him home.
NOTES: The Orioles designated LHP Dana Eveland for assignment to make room for Socolovich. ... Orioles 2B Robert Andino (shoulder) will begin a rehabilitation assignment Sunday with Triple-A Norfolk. He's eligible to return from the DL on Tuesday. ... Oakland LHP Brett Anderson (elbow) made a rehabilitation start for Triple-A Sacramento, throwing 53 pitches while allowing four earned runs in four innings. ... Orioles C Matt Wieters was rested with a tight right biceps. "We're going to make sure it feels OK before I get back in there," said Wieters, who is mired in a 1-for-30 skid.