BALTIMORE (AP) – In a disappointing season filled with frustrating defeats, the Oakland Athletics added one more lamentable loss to the ledger.

The A’s blew a four-run lead, then rallied against an All-Star closer before falling to the Baltimore Orioles 8-6 Friday night on Manny Machado’s game-winning home run in the 13th inning.

This defeat was more painful than most. Stephen Vogt homered and Oakland had 17 hits, including four from Coco Crisp, but the A’s went 5 for 16 with runners in scoring position, stranded 13 and had two players thrown out at the plate.

Baltimore got seven of its eight runs via the long ball, including a three-run drive by Adam Jones and a two-run shot by Chris Davis.

“We just made three bad pitches tonight,” Vogt said. “That’s the story of the game. And, unfortunately, they hurt us.”

Oakland has lost four in a row and 14 of 21.

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.

“It’s a tough job to get thrown into,” said Vogt, Oakland’s catcher. “Whether he rushed through his warmups or not, we don’t know. Unfortunately, he hung a changeup to Manny and he was right on it.”

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.

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.

The rally went for naught, and Oakland went down in a game that lasted 4 hours, 27 minutes.

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.

“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.”

Oakland provided that four-run cushion to 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. “I feel like I kind of let them back in and got the crowd back in it. It’s very disappointing.”

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.

TRAINER’S ROOM

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.”

ON DECK

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 fewer in five of his 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.