DENVER — Andrew Toles hit a grand slam with two outs in the ninth inning and the Los Angeles Dodgers overcome a late six-run deficit to beat the Colorado Rockies 10-8 on Wednesday night for a doubleheader split.

Down 8-2, the Dodgers scored three times in the eighth and added five more in the ninth. Toles capped the final inning with an oppose-field homer off closer Adam Ottavino (0-1) for his first career slam.

Luis Avilan (1-0) threw a scoreless eighth for the victory. Kenley Jansen pitched the ninth for his 40th save, getting David Dahl on a called third strike to end it.

The Dodgers began their comeback in the eighth with an RBI double from Yasmani Grandal, an RBI single by Joc Pederson and a sacrifice fly by Howie Kendrick. Chase Utley nearly brought in more, sending a two-out grounder up the middle with two on, but DJ LeMahieu ranged to his right, snared the ball and threw Utley out by a step to end the threat. Los Angeles scored once in the ninth on an RBI single from Josh Reddick and then loaded the bases with two outs, setting the stage for Toles.

Nolan Arenado hit a two-run homer finished with a Colorado-record 36 RBIs for the month, breaking the August record of 33 set by Andres Galarraga in 1996.

In the opener, Tyler Anderson pitched into the seventh inning in the Rockies’ 7-0 victory. Anderson (5-5) allowed six hits in 6 1/3 innings against the NL West leaders. He also had an RBI single in the second in the team’s first shutout at home this season.

Pinch-hitter Stephen Cardullo hit his first career homer in the seventh — on his 29th birthday.

Ross Stripling (3-6) surrendered three runs over six innings.

The doubleheader was necessitated by a rainout Tuesday.

CUBS 6, PIRATES 5

CHICAGO — Kris Bryant hit his 36th homer and made three solid plays at third base, helping Jason Hammel and Chicago top Pittsburgh for a three-game series sweep.

Addison Russell had two RBIs and an outstanding sliding catch as Chicago equaled the best August in franchise history with a 22-6 record, also accomplished in 1932. It was the Cubs’ first time with 22 wins in a month since it went 22-10 in September 1945.

Heading into the final stretch of the season, the Cubs (85-47) are rapidly closing in on their first division title since 2008. They begin September with the majors’ best record at a season-high 38 games over .500 and a whopping 15-game lead over second-place St. Louis in the NL Central.

Hammel (14-7) allowed three hits and struck out six after dropping his previous two starts.

Ryan Vogelsong Vogelsong was the loser.

GIANTS 4, DIAMONDBACKS 2

SAN FRANCISCO — Matt Moore struck out seven over 5 1/3 innings for his first career victory at AT&T Park, and San Francisco beat Arizona.

Moore walked off in the sixth to a standing ovation from the sellout crowd. The left-hander had lost his initial two home starts since being acquired from Tampa Bay. Moore (2-3) looked strong in his first game since losing a no-hit bid with two outs in the ninth inning at Dodger Stadium.

Buster Posey drove in a pair of runs for San Francisco.

Santiago Casilla relieved Sergio Romo with the bases loaded and two outs in the eighth and struck out Yasmany Tomas. Casilla finished for his 29th save.

Shelby Miller (2-10) was called up from Triple-A Reno to start. He allowed two runs and six hits in six innings.

YANKEES 5, ROYALS 4, 13 INNINGS

KANSAS CITY, Mo. — Brian McCann had a sacrifice fly in the 13th inning and Dellin Betances shut down Kansas City in the bottom half in New York’s victory.

Royals reliever Chris Young (3-9) gave up a single to Didi Gregorius and a double to Starlin Castro to lead off the decisive frame. Matt Strahm came in against McCann for a lefty-lefty matchup, and the New York designated hitter lofted a fly ball to left to score the go-ahead run.

Ben Heller (1-0) pitched a perfect 12th to earn his first major league win, and Betances wrapped up a winning series for the Yankees by working around a leadoff walk for his seventh save.

Castro hit a two-run homer for the Yankees. Kendrys Morales hit one for Kansas City.

METS 5, MARLINS 2

NEW YORK — Kelly Johnson’s three-run double in the eighth inning broke a tie and lifted surging New York over Miami.

Yoenis Cespedes began the rally by singling off reliever A.J. Ramos (1-2). Curtis Granderson walked, and Wilmer Flores flew out to center, advancing a hustling Cespedes to third. After Jay Bruce flew out to right, Travis d’Arnaud walked to load the bases, bringing up Johnson.

Johnson drove the ball into the right-field corner. He emphatically clapped his hands and swung his arms into the air after reaching second base.

Addison Reed (4-2) pitched a perfect eighth inning for the victory, the Mets’ third in a row. Jeurys Familia closed for his 44th save, establishing a franchise record.

ASTROS 4, ATHLETICS 3

HOUSTON — Evan Gattis hit an RBI single to cap a three-run rally in the eighth inning keyed by a wild pitch on a strikeout, leading Houston past Oakland.

Chasing Baltimore for the second AL wild-card slot, Houston swept the three-game series and will open a three-game set Friday at AL West-leading Texas.

A’s starter Ross Detwiler gave up three hits and left after the seventh with a 3-1 lead.

Reliever Liam Hendriks (0-3) got two quick outs in the eighth before George Springer tripled. Alex Bregman then struck out, but reached when the pitch got away, allowing Springer to score.

Jose Altuve tripled home the tying run and Gattis singled for the lead.

Michael Feliz (8-1) pitched a scoreless eighth. Ken Giles closed for his seventh save.

RANGERS 14, MARINERS 1

ARLINGTON, Texas — Rougned Odor homered twice a day after hitting a game-ending shot and Carlos Gomez connected for a grand slam off Felix Hernandez, sending Texas past Seattle for a three-game sweep.

Odor tied a career high with five RBIs, and Adrian Beltre and Ryan Rua also homered for the AL West leaders. Texas (80-54) moved a season-high 26 games over .500 with a fifth straight win.

The Rangers matched the 1999 and 2012 Texas teams as the fastest to reach 80 wins.

Odor had a two-run shot for a 10-0 lead in the seventh and a three-run homer in the eighth, and leads the team with 27 home runs. On Tuesday night, his two-run homer in the ninth gave Texas an 8-7 win.

Martin Perez (9-10) pitched six shutout innings. Hernandez (9-5) matched a season high by allowing six runs in his shortest outing, coming out after four innings.

RED SOX 8, RAYS 6

BOSTON — Hanley Ramirez hit a grand slam, and Aaron Hill later sliced an RBI single to break an eighth-inning tie to help Boston beat Tampa Bay.

Jackie Bradley Jr., who had three hits, and Xander Bogaerts each homered for the Red Sox. Dustin Pedroia had three more hits for Boston. The Red Sox had lost five of its previous seven games after moving into a tie for first place in the AL East.

Junichi Tazawa (3-2) earned the victory despite allowing a two-run single after Boston took a 6-4 lead on the homers by Ramirez and Bradley. Craig Kimbrel closed for his 24th save.

Erasmo Ramirez (7-10) gave up Hill’s single and an RBI double by Bradley in the eighth.

Logan Forsythe and Logan Morrison each homered for Tampa Bay.

BREWERS 3, CARDINALS 1

MILWAUKEE — Kirk Nieuwenhuis homered, Matt Garza pitched into the eighth inning and Milwaukee beat St. Louis to end a six-game losing streak.

Nieuwenhuis hit a three-run homer off Luke Weaver (1-2) in the third inning.

Garza (5-6) turned in his longest outing of the season, giving up one run and three hits in seven-plus innings while walking two and striking out eight. Tyler Thornburg notched his sixth save in 10 chances.

Yadier Molina homered for the Cardinals.

NATIONALS 2, PHILLIES 1

PHILADELPHIA — Jayson Werth homered and Gio Gonzalez pitched six strong innings to lead Washington to a three-game sweep of Philadelphia.

Wilson Ramos hit the go-ahead RBI single in the seventh inning to help NL East-leading Washington set a franchise record with its ninth straight victory over the Phillies. The Nationals remained nine games in front of the second-place New York Mets.

Gonzalez (10-9) gave up one run and two hits with four strikeouts and a walk. Shawn Kelley got the only batter he faced, Maikel Franco, to ground out to end the game for his seventh save.

Freddy Galvis homered for Philadelphia in the game was played through a persistent drizzle. Adam Morgan (1-9) lost his ninth straight.

ANGELS 3, REDS 0

ANAHEIM, Calif. — Ricky Nolasco pitched a dynamic four-hitter for his fifth career shutout and his first victory for Los Angeles, leading the Angels to an interleague sweep of Cincinnati.

C.J. Cron drove in two runs. The Angels (59-74) have won five straight and eight of 10 to climb out of last place in the AL West.

Los Angeles even won without Albert Pujols and Mike Trout, who weren’t in the lineup for an early starting game before the Angels’ day off.

Brandon Finnegan (8-10) struck out nine during seven strong innings of five-hit ball for the Reds. They have lost four straight and eight of 10.

INDIANS 8, TWINS 4

CLEVELAND — Corey Kluber struck out a season-high 11 and in his seventh straight victory, helping Cleveland hand Minnesota its 13th straight loss — one shy of tying the club record.

Unbeaten since July 3, Kluber (15-8) allowed three runs and six hits in eight solid innings. The right-hander is 7-0 with a 1.94 ERA in his last 10 starts.

Carlos Santana and Roberto Perez homered off Pat Dean (1-5), and Jose Ramirez hit a two-run double during a five-run fifth as the AL Central-leading Indians swept the three-game series.

Brian Dozier hit his 32nd homer, and Max Kepler also connected for the Twins

Minnesota loaded the bases with two outs in the ninth off rookie Perci Garner, making his major league debut. Bryan Shaw came on and threw a wild pitch before striking out Dozier for his first save.

BLUE JAYS 5, ORIOLES 3

BALTIMORE — Jose Bautista homered on the game’s first pitch and Russell Martin went deep four batters later in support of Aaron Sanchez, leading Toronto past Baltimore.

Toronto took two of the three games in the pivotal AL East series. The fading Orioles are four games behind the first-place Blue Jays and are tied with Detroit for the second wild card spot.

Sanchez (13-2) was recalled from Class-A Dunedin to make the start. He spent 10 days in the minors to limit his innings and he took advantage of the extra rest. Sanchez allowed an unearned run and five hits with two strikeouts over six innings and a season-high 112 pitches.

Michael Saunders hit his 23rd homer, a solo shot in the eighth that made it 5-1.

Yovani Gallardo (4-7) was the loser.

TIGERS 3, WHITE SOX 2

DETROIT — JaCoby Jones doubled twice in his second major league game, then dashed home for the winning run on Tyler Collins’ sacrifice fly in the ninth inning to lift Detroit past Chicago.

After a day after doubling, singling and driving in two runs in his debut, Jones scored twice to help the Tigers complete a three-game sweep.

Jones hit a leadoff double in the ninth against David Robertson (4-3) and advanced to third on Jarrod Saltalamacchia’s deep flyball. Collins came up as a pinch-hitter and was able to lift the ball to left-center. Avisail Garcia made the catch, but his throw bounced before it even reached the mound.

Francisco Rodriguez (2-3) pitched the ninth.

Jose Abreu and Alex Avila homered on consecutive pitches in the fourth for the White Sox.

BRAVES 8, PADRES 1

ATLANTA — Matt Wisler had a career-high 10 strikeouts in six innings, Gordon Beckham drove in two runs with a pinch-hit bases-loaded double in the sixth and Atlanta beat San Diego.

The Braves (50-83) no longer have the majors’ worst record. Minnesota (49-84) fell below Atlanta with its 13th straight loss, 8-4 to Cleveland.

Wisler (6-11) allowed one run on only four hits in his third straight win.

Oswaldo Arcia homered for the Padres. Paul Clemens (2-4) took the loss.