OAKLAND, Calif. — After giving up four runs in the first two innings, Domingo German provided the Yankees a chance to crawl back into Tuesday night’s game against the A’s.

Far from his sharpest, the majors’ leading winner kept the A’s from scoring in the third, fourth and fifth frames and watched his mates waste several scoring chances.

And when the A’s scored twice in the sixth inning with the help of left fielder Cameron Maybin’s fielding error, the ditch was too deep to climb out of and resulted in a 6-2 Yankees loss that was witnessed by a crowd of 21,471 inside the dilapidated Oakland Coliseum.

“I felt good, [but] that first inning was a tough inning,’’ said German, who fell to 16-3 with his first loss since June 7. “Part of the game, a bad day. As a pitcher, you understand that will happen.’’

In 5 ¹/₃ innings, German allowed six runs (five earned), eight hits, walked two and struck out seven.

“I thought he was OK, just not overly sharp. The walk to [Robbie] Grossman a little uncharacteristic. He usually pounds the strike zone,’’ Aaron Boone said of German, who followed the walk to Grossman by striking out Matt Chapman in front of a first-pitch homer to Matt Olson and watching Mark Canha hit a 1-1 pitch for a home run. “I thought he settled in pretty well, maybe not his best stuff overall. I thought he pitched better than his line.’’

The loss didn’t reduce the Yankees’ 10-game AL East lead over the second-place Rays because they lost to the Mariners.

After getting Chris Hermann to fly out to start the fifth, German went down on the mound after finishing a pitch and came up shaking his left leg. That brought trainer Steve Donohue and Boone to the mound and they left with German still on the hill.

“It was an awkward landing, bent my foot a little bit,’’ German said.

The Yankees scored in the first on Gary Sanchez’s solo homer off Homer Bailey, who allowed one run and seven hits in 5 ²/₃ innings to beat the Yankees for a second time this season. He beat them April 18 at Yankee Stadium when with the Royals.

Aaron Judge homered for the first time since Aug. 4 starting the eighth and for just the second time since July 19. Judge entered Tuesday night’s game with one homer and eight RBIs in his previous 28 games (27 starts).

“Hoped to start a rally but didn’t do it,’’ Judge said of his 13th homer, which came after he had struck out twice and popped up.

It also might have been the latest step in the right direction since Judge entered the game with four hits in eight at-bats in his previous two games.

The other lone bright spot for the Yankees was Jonathan Loaisiga providing 2 ²/₃ shutout innings in relief of German.

The Yankees had 11 hits but went hitless in five at-bats with runners in scoring position and left eight on base. Gleyber Torres stranded two runners in the first, Didi Gregorius left two on in the third and Austin Romine and Mike Tauchman failed to take advantage of Maybin being on second with one out in the fourth.

Four A’s hurlers combined to strike out 13 Yankees.

Prior to the game, Boone talked about the possibility of eventually altering German’s workload.

“There may be a time when we skip him a turn in September or something or it could be when we shorten a couple of his outings,’’ Boone said. “Nothing is concrete as far as that goes but those are things we will kind of talk through.

With 121 ¹/₃ innings this year, German is close to exceeding his professional high of 123 ¹/₃ frames set in 2014 when he was in the minor leagues. The 85 ²/₃ innings German threw last year were his major league high.