Yankees pitcher CC Sabathia, right, hands the ball to manager...

Yankees pitcher CC Sabathia, right, hands the ball to manager Aaron Boone, left, as he is relieved during the fourth inning against the Athletics in Oakland, Calif. on Monday. Credit: AP/Jeff Chiu

OAKLAND, Calif. — If the Yankees aren’t careful, the American League wild-card game they’re all but a shoo-in for will be played about 2,900 miles from home.

The Yankees kicked off a key nine-game trip with a 6-3 loss to the A’s, the team they figure to see in that game, at Oakland Coliseum on Monday afternoon.

The Yankees (86-52) fell 8½ games behind the AL East-leading Red Sox and saw their lead over the A’s (83-56) for the top wild-card spot trimmed to 3½ games (four in the loss column).

The A’s have the majors’ best record since June 16 (49-20) and are an MLB-best 28-14 since the All-Star break.

“I keep saying it, but I’m not too concerned about where we’re at in the standings in relation to them or in relation to Boston,” Brett Gardner said. “I’m just concerned about us playing better. I think we’ve got a really, really good team, a team that can do a lot of damage and be dangerous deep into the postseason. But we’ve got to play better if we want to get there. It’s up to us to figure out a way to do that.”

CC Sabathia (7-6, 3.54) did not pitch well in his return to the Bay Area, where he grew up. He gave up five runs (four earned) and seven hits in 3 1⁄3 innings.

A.J. Cole came on with one on and one out in the fourth and allowed Jed Lowrie’s two-out RBI single. Mark Canha’s two-out homer off Cole in the fifth made it 6-3.

Sabathia was 12-0 with a 2.81 ERA in his previous 22 starts following a Yankees loss, but he was just 5-7, 5.20 in his career at Oakland Coliseum.

When asked what went wrong, he said, “Everything. I just didn’t make enough good pitches. Couldn’t get the ball in, didn’t feel like it was coming out of my hand [very well]. It was just one of those days.”

A’s righthander Trevor Cahill allowed three runs (two earned) and four hits in five innings. Bob Melvin’s shutdown bullpen took it from there, striking out eight in four scoreless, hitless innings. Lou Trivino, Yusmeiro Petit, Ryan Buchter and Jeurys Familia got the ball to Blake Treinen, and the All-Star closer — who has the lowest ERA among MLB relievers (0.91) — pitched a perfect ninth for his 36th save.

“They do a good job shortening the game because they can really match up,” Aaron Boone said. “You know you have to play well to beat these guys.”

Most of the Yankees’ meager offense was provided by Luke Voit, whose two-run homer to right-center in the second tied the score at 3-3 and further secured his hold on the starting job at first. Voit, who again demonstrated his opposite-field power, has six homers and 12 RBIs in his last 11 games and has 15 hits in his last 38 at-bats (.395).

The Yankees gave Sabathia a quick 1-0 lead as Andrew McCutchen singled for his first hit with his new team, stole second, went to third when the throw went into centerfield and scored on Aaron Hicks’ sacrifice fly.

But Sabathia labored through a 39-pitch first inning in which the A’s sent nine to the plate and scored three runs. They had four straight singles, and after Matt Olson battled back from a 1-and-2 count to draw a bases-loaded walk, Miguel Andujar’s two-out throwing error allowed an unearned run to score.

After Voit’s homer tied it, Sabathia walked Marcus Semien on four pitches to start the bottom of the second and Matt Chapman lasered one into the gap in left-center. Centerfielder Hicks took a bad angle and the ball went to the wall, allowing Semien to score to make it 4-3.

The first two Yankees batters reached base in the seventh, but Voit and Neil Walker struck out and Gardner popped to left. With two outs in the eighth, Familia walked Hicks and Andujar but struck out Gary Sanchez to conclude an eight-pitch at-bat.

“They have some dynamic guys down there that make it tough,” Boone said of the Oakland bullpen. “It’s hard, but it’s that time of year. It’s hard. If you want to be great, it’s hard. We have to keep grinding away here and do a better job of rallying back.”

More Yankees headlines