BALTIMORE - The Orioles entered the ninth inning with a two-run lead and Zach Britton on the mound, a seemingly sure-fire recipe for victory.
Baltimore ended up winning all right, though not in the anticipated fashion.
Manny Machado hit a two-run homer in the 13th inning, and the Orioles also got home runs from Adam Jones and Chris Davis in getting past the Oakland Athletics 8-6 Friday night.
Caleb Joseph doubled with one out in the 13th against Drew Pomeranz (4-5), who left with forearm tightness following a consultation with the team trainer. Aaron Brooks entered, and Machado sent the right-hander's second pitch into the seats in left field.
That enabled the Orioles to avoid a third straight defeat, which would have dropped them to .500 for the first time since July 27. The defending AL East champions are in third place in the division and 1 1/2 games off the pace in the wild-card hunt.
"We needed this win t o get us going," Machado said. "We're just glad we got it over with, however it was."
Britton was trusted to protect a 6-4 lead in the ninth. He had converted 24 straight save opportunities, one reason why Baltimore was 51-0 when leading after eight innings.
On this occasion, however, the A's put together a few infield hits before Josh Phegley drove in a run with a groundout. Former Oriole Danny Valencia followed by hitting an 0-2 pitch for a two-out, RBI single.
"I can make a better pitch right there," Britton said. "That's probably the only pitch I want back."
It all worked out in the end, though.
"Winning is the name of the game," Britton said. "That's all that matters at the end of the day."
Rookie Jason Garcia (1-0) got three straight outs in the 13th to earn his first major league victory.
Earlier, Baltimore rallied from a 4-0 deficit. After Jones hit a three-run drive in the fifth, he added a sacrifice fly in the seventh before Davis ripped a 1-2 pitch from Fernando Abad far over the right-field wall to make it 6-4.
Abad had not allowed an earned run in 13 appearances since July 8.
Stephen Vogt homered and Coco Crisp had four hits for the Athletics, who have lost 14 of 21. Oakland had 17 hits but stranded 13 and had two runners thrown out at the plate.
"Anytime you have a 4-0 lead, you feel you're in a pretty good position to win the game," A's manager Bob Melvin said. "Just a three-run homer - and that's what they do is hit home runs - got them right back in it."
After being no-hit in Seattle on Wednesday by Hisashi Iwakuma, the Orioles ended a run of 12 straight hitless innings when J.J. Hardy singled in the second. But Baltimore extended its streak of consecutive scoreless innings to 15 before Jones connected in the fifth.
Oakland provided a four-run cushion for left-hander Brad Mills, who was recalled from Triple-A Nashville to make his 2015 major league debut. Mills came in 3-0 with a 1.56 ERA lifetime against Baltimore and 1-4 with a 10.16 ERA against everyone else.
His success against the Orioles continued until the fifth, and Mills didn't make it to the sixth.
"It makes it a little more painful when you give it up like that," Mills said.
Baltimore's comeback negated a poor start by Ubaldo Jimenez, who needed 102 pitches to get through five innings. He allowed four runs, nine hits and two walks.
Athletics: RHP Sonny Gray says his back spasms have settled considerably, and he expressed hope of returning to the rotation for Monday's series finale.
Orioles: C Matt Wieters feels improvement in his strained right hamstring. "I don't feel it's a DL thing," he said. "As long as I can run close to the slow speed I normally am, it will be good."
Athletics: Chris Bassitt (1-4, 2.48 ERA) looks for a little support Saturday night. The right-hander has been backed by one run or less in five of hi s seven starts.
Orioles: Miguel Gonzalez (9-8) has given up 12 runs in his last three starts but can clinch a third straight season with double-digit wins.
Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.