Eric Thames scored the tiebreaking run on an error by losing pitcher Bud Norris in the eighth inning Monday night as the Milwaukee Brewers outlasted the visiting St. Louis Cardinals 6-4 in a potential National League wild-card game preview.

By winning the opener of a three-game series, the wild-card-leading Brewers reduced their magic number for clinching a playoff spot to three and moved within 1 1/2 games of the first-place Chicago Cubs in NL Central.

The Cardinals, who fell three games behind Milwaukee, hold just a half-game lead for the second wild card over the Colorado Rockies.

Ryan Braun homered for the Brewers, and Christian Yelich drove in two runs.

Pirates 5, Cubs 1

Francisco Cervelli and Pablo Reyes each homered and drove in two runs, and visiting Pittsburgh pulled away for a win over Chicago.

Jose Osuna added a pair of hits and an RBI for the Pirates. Pittsburgh (79-76) has won seven of its past nine games and eight of its past 11 as it looks to finish the season above .500 for the first time since 2015.

Chicago starter Cole Hamels (9-11) led his team at the plate with a solo homer. He gave up three runs (two earned) in six innings.

Dodgers 7, Diamondbacks 4

David Freese had three hits and two RBIs, and Manny Machado doubled and drove in two runs as Los Angeles maintained its 1 1/2-game lead over Colorado in the National League West with a comeback victory over Arizona in Phoenix.

Freese hit a bases-empty homer in the fifth inning and had an infield single to load the bases in a two-run seventh, when Machado drove in the go-ahead run on a groundout to shortstop for a 4-3 lead.

Clayton Kershaw (9-5) gave up six hits and three runs in six innings while making his 15th consecutive quality start, benefiting from the Dodgers’ seventh-inning rally to get the victory. He struck out six and walked one, and he has not lost since July 21.

Rockies 10, Phillies 1

Jon Gray tossed seven strong innings, Gerardo Parra had three hits, and streaking Colorado continued its late-season playoff push with a win over Philadelphia in Denver.

Trevor Story had two doubles in his return to the lineup for Colorado, which won its fourth straight. David Dahl added a two-run homer.

Slideshow ( 20 images )

Rhys Hoskins hit a solo homer in the seventh inning to break up Gray’s shutout bid.

Athletics 7, Mariners 3

Shortly after learning that it had clinched its first playoff spot since 2014, visiting Oakland got homers from Jonathan Lucroy, Jed Lowrie, Khris Davis and Matt Chapman in a win at Seattle.

The clincher for the A’s came when the New York Yankees defeated Tampa Bay, formally knocking the Rays out of contention for the second wild-card spot in the American League.

The A’s can still earn the first wild card -- and the home-field advantage in the single-elimination playoff game that comes with it -- by finishing ahead of the Yankees. Oakland trails New York by 1 1/2 games.

Red Sox 6, Orioles 2

Mookie Betts hit his career-high 32nd homer to help Boston take an early lead en route to a victory over visiting Baltimore.

The victory was big for the Red Sox as it clinched home-field advantage throughout the American League playoffs, which start next week. Boston improved to 106-51, breaking the franchise’s single-season wins record.

Betts finished 2-for-5 with two RBIs plus a stolen base, his 29th of the season, and now he has a major-league-leading .343 average.

Yankees 4, Rays 1

Brett Gardner delivered a tiebreaking single in the fifth inning and made a game-saving catch an inning later as New York Yankees inched closer to securing home-field advantage in the AL wild-card game with a victory at St. Petersburg, Fla.

New York used eight pitchers, with Sonny Gray (11-9) getting the win in relief and Zach Britton picking up his seventh save.

Andrew McCutchen led the Yankees’ offense with two hits, including third-inning solo homer.

Angels 5, Rangers 4 (11 innings)

Slideshow ( 20 images )

Jose Briceno’s home run leading off the bottom of the 11th inning gave Los Angeles a victory over Texas in Anaheim, Calif.

Briceno, pinch-hitting for fellow catcher Francisco Arcia, hit an 0-2 pitch from Matt Moore (3-8) over the fence in left-center field to end the Angels’ five-game losing streak.

Los Angeles earlier got solo homers from Shohei Ohtani, Jefry Marte and Michael Hermosillo.

Indians 4, White Sox 0

Corey Kluber struck out 11 in earning his 20th victory, and Brandon Guyer hit a seventh-inning home run to break up a scoreless tie as visiting Cleveland earned a shutout victory over Chicago.

Kluber (20-7) went seven scoreless innings and became the second 20-game winner in baseball after the Rays’ Blake Snell. It was Kluber’s 46th career start with double-digit strikeouts. The right-hander allowed four hits and one walk.

Indians pitchers retired the last 17 batters they faced, as Andrew Miller threw a perfect eighth inning and Cody Allen did the same in the ninth.

Astros 5, Blue Jays 3

Brian McCann and Josh Reddick hit back-to-back solo homers in the second inning, Dallas Keuchel pitched five innings, and Houston won at Toronto.

Keuchel (12-11) allowed three runs, seven hits and three walks while striking out five.

Houston maintained a 4 1/2-game lead over the A’s in the American League West.

Nationals 7, Marlins 3

Anthony Rendon drove in four runs to lead host Washington to a win over Miami.

Rendon went 2-for-4 with a two-run homer and a two-run double.

Washington’s Stephen Strasburg was in line for his 10th win of the season, but he walked four batters in four innings and was removed after his pitch count reached 100. He allowed three hits and one run in four innings.

Padres 5, Giants 0

Bryan Mitchell pitched 8 2/3 shutout innings to lead San Diego to a victory at San Francisco.

Kirby Yates came on with the bases-loaded in the ninth to strike out pinch hitter Austin Slater for his 11th save of the season.

Mitchell (2-4) allowed seven hits and three walks with a season-high seven strikeouts. His totals of 8 2/3 innings and 118 pitches were career highs.

--Field Level Media