CHICAGO (AP) — The St. Louis Cardinals became the first team to clinch a playoff berth this year despite losing 5-4 to the Chicago Cubs on Saturday.

San Francisco's loss to Arizona ensured the Cardinals at least an NL wild card. St. Louis has the best record in the majors at 92-56 and will play in the postseason for the fifth straight year. The Cardinals have made it at least to the NL Championship Series the last four seasons.

Jorge Soler and Kris Bryant hit back-to-back homers for Chicago, and tempers flared for the second consecutive game as the Cubs won their fifth straight to tighten the NL Central race.

Chicago is five games behind first-place St. Louis, which got a two-run homer from Matt Carpenter in the ninth. The Cubs are comfortably in position for a wild card.

Bryant's 25th homer tied the Cubs record for a rookie set by Billy Williams in 1961. Soler went deep for the first time since missing 23 games with a left oblique strain.

The Cubs used eight pitchers in a patchwork effort to cover for an empty spot in the rotation. The second pitcher, Trevor Cahill (1-3), earned his first win with the Cubs by pitching 3 1/3 scoreless innings.

Pedro Strop got three outs for his third save, aided by a diving play from shortstop Addison Russell to end it.

Michael Wacha (16-6) had won five of his previous six decisions.

YANKEES 5, METS 0

NEW YORK (AP) — Carlos Beltran hit a three-run homer off a 100 mph (161 kph) fastball from Noah Syndergaard in the first inning and Michael Pineda pitched his best game in two months as the New York Yankees beat the Mets to rebound from an opening loss in the Subway Series.

Brian McCann added a two-run drive in the sixth, the Yankees' 200th home run this season, to quiet the sellout crowd of 43,630 at Citi Field.

Hoping to reach the postseason for the first time since 2006, the Mets have a seven-game lead in the NL East over Washington.

Trying to make the playoffs after their first two-year absence since the early 1990s, the Yankees moved within 3 1/2 games of first-place Toronto in the AL East. The Yankees also lead the wild-card race.

Pineda (11-8) allowed four singles in 5 1-3 innings to win for just the second time since the All-Star break.

Syndergaard (8-7) gave up five runs in six innings.

RED SOX 7, BLUE JAYS 6

TORONTO (AP) — David Ortiz singled home the go-ahead run in a five-run ninth inning and Boston rallied to beat Toronto.

Jackie Bradley Jr. snapped an 0-for-21 slump with a tying double in the seventh, then tied it again with a two-run homer off Roberto Osuna (1-5) in the ninth.

It was the first time in 74 such situations this season that the Blue Jays lost when leading after eight innings.

Xander Bogaerts also homered for the Red Sox. Tommy Layne (2-1) got two outs and Robbie Ross overcame Jose Bautista's two-run homer in the ninth to earn his third save.

Edwin Encarnacion homered and had three RBIs for the Blue Jays, including a go-ahead single in the eighth.

ANGELS 4, TWINS 3, 12 innings, 1st game

ANGELS 5, TWINS 2, 2nd game

MINNEAPOLIS (AP) — Albert Pujols had two hits and two RBIs, and Garrett Richards was one out away from his second complete game this season as Los Angeles completed a sweep of a day-night doubleheader.

Mike Trout and Chris Iannetta added solo homers for Los Angeles (76-72), which won its third straight in the series and pulled a game ahead of Minnesota (75-73) in the AL wild-card race.

Richards (14-11) gave up five hits and two runs, including a solo homer to Trevor Plouffe.

Mike Pelfrey (6-10) allowed four runs on nine hits for Minnesota, which has lost five in a row at home.

Los Angeles took the first game of the doubleheader 4-3 when Kole Calhoun's liner eluded shortstop Eduardo Escobar's glove to allow Daniel Robertson to score from third in the 12th inning.

Mike Morin (3-1) struck out the only two batters he faced for the win. Huston Street earned his 37th save. Blaine Boyer (3-5) allowed an unearned run in 1 1/3 innings.

NATIONALS 5, MARLINS 2

WASHINGTON (AP) — Bryce Harper tied the game with a sacrifice fly, then added insurance with his 41st homer — a two-run shot into the second deck in right field that earned "M-V-P!" chants — as Washington came back to beat Miami.

Harper entered the day leading the NL in homers, batting average and runs. His three RBIs raised his total to 95, putting him 17 behind Colorado's Nolan Arenado.

Jordan Zimmermann (13-8) allowed two runs over six innings, both in the first. Jonathan Papelbon got his 24th save.

Brad Hand (4-7) gave up three runs, four hits and six walks in 4 2-3 innings. He is 0-8 in 12 appearances — 10 starts — against the Nationals.

DIAMONDBACKS 6, GIANTS 0

SAN FRANCISCO (AP) — Patrick Corbin pitched seven sharp innings and helped his own cause with an RBI single as Arizona blanked San Francisco.

Ender Inciarte had three hits and two RBIs, while David Peralta and A.J. Pollock added three hits apiece for Arizona. The Diamondbacks have won four of their last five against the defending World Series champs, and five straight at AT&T Park.

Corbin (6-4) ended his own skid in San Francisco after going winless in four previous starts at the ballpark. David Hernandez and Josh Collmenter completed Arizona's second consecutive shutout in the series.

Mike Leake (10-9) gave up three runs and eight hits over three innings, his shortest outing since 2013. Leake has won only one of his seven starts since being acquired from Cincinnati in late July.

ORIOLES 2, RAYS 1

ST. PETERSBURG, Florida (AP) — Chen Wei-yin pitched seven effective innings and Adam Jones drove in two runs as Baltimore beat Tampa Bay.

Chen (10-7) allowed one run and struck out seven. He ended his outing by escaping a two-on, no-out jam.

Darren O'Day worked a scoreless eighth before Zach Britton got three outs for his 34th save.

Erasmo Ramirez (10-6) took the loss.

BRAVES 2, PHILLIES 1

ATLANTA (AP) — Freddie Freeman hit a two-run double in the eighth inning and Atlanta has won consecutive games for the first time since winning three straight in early August.

The Phillies have dropped five straight and 13 of 16

Freeman's opposite-field double off former starter Jerome Williams (4-11) went off the wall in left field when Sweeney appeared to misjudge the trajectory of the ball, allowing Nick Markakis to score from second and pinch-runner Pedro Ciriaco from first.

Edwin Jackson (3-3) earned the win after striking out one and facing the minimum in the eighth. Arodys Vizcaino earned his sixth save in seven chances after facing four batters in the ninth.

WHITE SOX 4, INDIANS 3

CLEVELAND (AP) — Carlos Rodon allowed one run while pitching into the eighth inning and Chicago defeated sloppy Cleveland.

Rodon (8-6) went 7 2/3 innings and beat Cleveland for the third time this season. Micah Johnson's fifth-inning single broke a 1-all tie, handing the Indians a costly loss as they attempt to remain in the race for the second AL wild card.

A wild pitch by Carlos Carrasco (13-11) and two misplays by rookie shortstop Francisco Lindor hurt Cleveland, which entered play trailing Houston by four games in the wild-card chase.

The game ended when Abraham Almonte was picked off first base by closer David Robertson.

The Indians (73-74), who also trail the Angels and Twins in the wild-card standings, have alternated wins and losses in their last seven games.

REDS 9, BREWERS 7

MILWAUKEE (AP) — Todd Frazier homered to become just the second Reds player with at least 40 doubles and 35 home runs in a season, helping rally Cincinnati past Milwaukee.

Brewers third baseman Elian Herrera was taken away on a backboard and stretcher after a collision in the eighth inning.

With two on and two outs in the eighth, Skip Schumaker hit a looping fly ball down the left field line. Herrera, left fielder Shane Peterson and shortstop Jean Segura all chased the ball, but Herrera and Peterson collided, with the ball falling between them. Herrera did not move for more than five minutes while being treated by Brewers trainers before being rolled onto his back. He left the field in an ambulance.

Eugenio Suarez scored and Schumaker ended up at second with a double.

Burke Badenhop (2-4) got the win, and Tyler Cravy (0-7) took the loss.

ASTROS 10, ATHLETICS 6

HOUSTON (AP) — Evan Gattis hit a three-run homer to put Houston ahead in the seventh inning, and the Astros snapped a five-game losing streak.

Houston leads the race for the second AL wild card by 1 1/2 games over the Los Angeles Angels, who swept a doubleheader at Minnesota. The Astros began the night 2 1/2 games behind first-place Texas in the AL West.

With the Astros trailing by a run in the seventh, Gattis hammered a pitch from reliever Fernando Rodriguez (4-2) to right field, giving Houston the lead for good and sending the crowd into a frenzy.

Mark Stassi added a solo shot and Jake Marisnick scored on a sacrifice fly in the eighth for Houston.

Chad Qualls (3-4) pitched a scoreless seventh for the win.

RANGERS 10, MARINERS 1

ARLINGTON, Texas (AP) — Cole Hamels struck out 12 over seven innings, and Adrian Beltre had three hits and three RBIs to lead Texas.

The Rangers maintained their 2 1/2-game AL West lead over the Houston Astros, who also won.

Hamels (10-8) gave up seven hits, including a second-inning home run by Franklin Gutierrez to center field, and walked none. He improved his record to 4-1 since being traded by the Philadelphia Phillies before the non-waiver trade deadline.

Beltre hit a two-run double with the bases loaded in the fourth and singled in a run in the fifth. He got on base his first four times up and reached in 10 consecutive plate appearances.

Mariners starter Vidal Nuno (1-3) lasted 3 1-3 innings, allowing four earned runs on five hits and four walks.

ROCKIES 10, PADRES 2

DENVER (AP) — Tom Murphy had an RBI single and a home run — his first major league hits — and Colorado overcame the loss of starting pitcher Yohan Flande after he was struck in the left leg by a line drive.

Charlie Blackmon had three hits, including an RBI single, and scored three times, and Nolan Arenado singled twice to drive in two runs for the Rockies, who have won six of nine.

Jedd Gyorko homered and doubled and Justin Upton had an RBI single for San Diego.

Christian Bergman (3-0) pitched 3 1-3 innings of one-run relief after coming on in the third inning to replace Flande, who was hit in the left knee area by a line drive hit by Gyorko, who had a double.

Robbie Erlin (0-1), the first left-handed starter for the Padres this season, went three-plus innings and allowed seven runs and nine hits in his season debut.

TIGERS 6, ROYALS 5, 11 innings

DETROIT (AP) — Ian Kinsler homered in the 11th inning to give the win.

Kinsler led off the 11th against Miguel Almonte (0-1) and hit a 1-2 curveball into the Tigers' bullpen for his second walk-off homer against Kansas City this season. He also hit one on August 6.

Tom Gorzelanny (2-0) got the win with two innings of scoreless relief.

The celebration at home was Kinsler's second in three innings, but this one counted.

Kinsler was initially called safe at home on a sacrifice fly in the ninth inning, setting off a mob scene at the plate. However, a replay review showed Royals catcher Salvador Perez caught Jarrod Dyson's off-line throw and caught the tip of Kinsler's shoe with a diving tag to end the inning.

PIRATES 3, DODGERS 2

LOS ANGELES (AP) — Aramis Ramirez hit a tiebreaking double in the eighth inning, Andrew McCutchen doubled home two runs, and Pittsburgh ended a four-game skid.

The Pirates climbed within four games of NL Central-leading St. Louis following the Cardinals' 5-4 loss at Chicago. The Pirates remained a game ahead of the Cubs in the race for the first wild card, with both teams comfortably in playoff position.

Despite the Dodgers' sixth loss in 24 games, their magic number for clinching their third straight NL West title dropped to seven because San Francisco lost to Arizona.

Francisco Liriano (11-7) allowed two runs and five hits over seven innings, striking out nine.

The Dodgers' Clayton Kershaw (14-7) was charged with three runs and seven hits in seven-plus innings. He struck out eight, raising his major league-leading total to 272 with three starts left in the regular season.