NEW YORK — DJ LeMahieu homered on the first pitch in the bottom of the 11th inning and the New York Yankees beat Oakland 4-3 on Saturday for their first victory in five tries against the Athletics this season.

Aaron Judge hit a tying homer for New York with two outs in the eighth, his 19th of the season and sixth in eight games. The 6-foot-7 Judge also took a potential home run away from Matt Chapman in the 10th, barely needing to leave his feet for a grab at the right field wall.

Gary Sánchez went deep twice and the AL East leaders finally took down the A’s, once again a potential playoff opponent come October. New York defeated Oakland in the AL wild-card game last year, and the Athletics are in a close race with Cleveland and Tampa Bay for the two American League wild cards this season.

LeMahieu, an MVP contender in his first season with the Yankees, was 0 for 4 with three strikeouts in the leadoff spot before driving a 97 mph fastball from Lou Trivino the other way to right field for his 24th home run.

Trivino (4-6) was beginning his third inning of work.

It was LeMahieu’s third career walk-off hit and New York’s first game-ending homer this season.

BLUE JAYS 6, ASTROS 4: Cavan Biggio and Teoscar Hernandez each hit a two-run home run, Clay Buchholz pitched into the sixth inning to win for the first time in more than a year, and Toronto won at home.

Biggio went 2 for 3 with a walk, drove in three and scored twice against the team his Hall of Fame father Craig starred with for 20 seasons.

Bo Bichette and Brandon Drury each had two hits as the Blue Jays won for the second time in five games.

Houston has lost two of three after winning six straight and nine of the previous 10.

Buchholz (1-3) allowed two runs and three hits in 5 2/3 innings, using four double plays to overcome a season-high five walks, including four leadoff walks.

TIGERS 10, TWINS 7: Minnesota hit six home runs and broke the major league record for home runs in a season but couldn’t overcome Detroit’s seven-run third inning at home.

The Twins have 268 homers, one more than the New York Yankees had last year. Minnesota broke the mark when Mitch Garver led off the ninth with a drive to left.

RAYS 9, INDIANS 6: Tommy Pham and Avisail Garcia hit two-run homers, Ji-Man Choi and Travis d’Arnaud had solo shots, and Tampa Bay won at St. Petersburg, Florida.

ROYALS 7, ORIOLES 5: Whit Merrifield hit a tiebreaking sacrifice fly in the eighth inning after Kansas City loaded the bases on three bunts at home.

NATIONAL LEAGUE

CARDINALS SWEEP REDS: Matt Carpenter and Harrison Bader hit run-scoring singles during a two-run ninth inning, and St. Louis won 3-2 at home in the second game.

Dakota Hudson pitched a career-high 72/3 innings in a 10-6 victory in the opener.

BREWERS 2, CUBS 0: Manny Piña drove in two runs with a first-inning single and Josh Hader finished a strong performance by Milwaukee’s bullpen, helping the short-handed Brewers win in Chicago.

Ben Gamel added three hits as Milwaukee pulled within four games of Chicago for the second NL wild card. Gamel was recalled from the minors before the victory.

The Brewers used five pitchers in the six-hitter. Zach Davies worked 4 2/3 innings before Matt Albers finished the fifth. Drew Pomeranz got two outs and Junior Guerra (8-4) worked 1 2/3 innings of hitless ball.

Hader then earned his 27th save, recording five outs on just 12 pitches. The All-Star left-hander struck out two.

Regulars Ryan Braun, Lorenzo Cain, Mike Moustakas and rookie Keston Hiura were out of Milwaukee’s starting lineup. Braun pinch-hit in the sixth and Cain entered in a double switch in the bottom of the eighth.

METS 6, PHILLIES 3: Wilson Ramos matched his career high with four hits and extended his hitting streak to 24 games, helping New York win in Philadelphia.

Todd Frazier had three hits, two RBI and made a stellar, run-saving catch in the sixth inning for the Mets, who pulled within four games of the Cubs for the second NL wild card.

Ramos had three singles and a double, upping his average to .446 (41 for 92) during the streak. He drove in one and is hitting .299 for the season.

The Mets will go for the series sweep Sunday night.

Bryce Harper homered and drove in two for Philadelphia, which remained 3 1/2 games behind the Cubs.

NATIONALS 7, MARLINS 0: Stephen Strasburg struck out 14 in eight crisp innings, Anthony Rendon homered twice and Washington won at home.

Comments are not available on this story.