LOS ANGELES — The Los Angeles Dodgers clinched their fifth straight NL West title, beating the San Francisco Giants 4-2 on Friday night as Cody Bellinger set an NL rookie record with his 39th home run.

Los Angeles will open the NL Division Series at home on Oct. 6. The Dodgers are seeking to reach the World Series for the first time since 1988 under manager Tommy Lasorda, who was on hand at Dodger Stadium to celebrate his 90th birthday.

Bellinger hit a three-run homer in the third off Jeff Samardzija (9-15), topping the NL rookie mark set by Wally Berger in 1930 and matched by Frank Robinson in 1956.

After a record run that saw the Dodgers push their record to 91-36, they had gone just 6-20 — including a dismal 1-16 stretch — to make clinching their division more laborious than anticipated. Los Angeles stopped a nine-game home losing streak.

Rich Hill (11-8) allowed one run and five hits in six innings with ninth strikeouts. Pablo Sandoval homered leading off the ninth against Kenley Jansen, who struck out the next three batters for his 40th save in 41 chances.

CUBS 5, BREWERS 4, 10 INNINGS

MILWAUKEE — Pinch-hitter Tommy La Stella drew a bases-loaded walk off All-Star closer Corey Knebel with one out in the 10th inning, helping the Chicago Cubs beat the Milwaukee Brewers 5-4 on Friday night to tighten their grip on the NL Central.

The Cubs hold a five-game lead with nine days left in the regular season after winning their second straight tense game over the Brewers. Milwaukee dropped into third in the division, 5 1/2 games behind Chicago, after St. Louis beat Pittsburgh.

The Brewers had the tying run at first with one out in the bottom of the 10th, but Eric Sogard was called out at second trying to advance on a ball in the dirt. Shortstop Addison Russell appeared to hold the tag as Sogard’s foot lifted off second for a split-second, and the call was confirmed on review.

Knebel (1-4) took the loss after allowing three walks and two hits over two innings. Carl Edwards Jr. (5-4) got the win with 1 2/3 innings of scoreless relief.

MARINERS 3, INDIANS 1

SEATTLE — Nelson Cruz hit a game-ending two-run homer in the ninth inning, lifting Seattle over Cleveland.

Cruz lined a 2-1 pitch from closer Cody Allen (3-7) out to deep right-center field, snapping Seattle’s six-game skid and improving its very slim wild-card hopes. The Mariners are five games behind Minnesota for the last AL playoff spot with eight games remaining.

Cruz also cooled baseball’s hottest team. Cleveland lost for the second time since Aug. 23, a span of 29 games that included an historic 22-game winning streak. It ended a franchise-record 14-game road winning streak — the Indians hadn’t lost away from home since Aug. 20 at Kansas City.

Erasmo Ramirez shut down Cleveland for eight innings, and Edwin Diaz (4-6) pitched the ninth to cap a three-hitter.

CARDINALS 4, PIRATES 3

PITTSBURGH — Randal Grichuk scored after an error by shortstop Jordy Mercer, capping a frantic ninth-rally that lifted surging St. Louis over Pittsburgh.

The playoff-chasing Cardinals won their fourth straight, despite trailing by a run entering the ninth. They’re 1 1/2 games behind the Rockies for the final NL wild card.

Stephen Piscotty led off with a double to right against closer Felipe Rivero (5-3), and Jedd Gyorko followed with a pinch-hit RBI single. After Tommy Pham’s single, Grichuk pinch-ran for Gyorko at third. He scored when Mercer misplayed Dexter Fowler’s sharp groundball.

Former Pirates reliever Juan Nicasio (4-5) got the win after working the eighth and ninth. Fowler and Piscotty had two hits each.

ROCKIES 4, PADRES 1

SAN DIEGO — Nolan Arenado ended Colorado’s scoreless streak at 23 innings with a solo homer, and the Rockies beat San Diego.

Colorado hadn’t scored since the eighth inning of a loss to San Francisco on Tuesday night, dropping a pair of shutouts in between. Arenado sparked the Rockies with his 35th homer, and Ian Desmond and Trevor Story also went deep.

Jon Gray (9-4) pitched six innings to win his fourth straight road start, and Colorado stayed 1 1/2 games ahead of the St. Louis Cardinals for the final NL wild card. The Milwaukee Brewers are two games back.

Greg Holland got his 41st save, tying Jose Jimenez’s club record from 2002.

The Rockies had no baserunners against former teammate Jordan Lyles (1-4) before Arenado hit the second pitch of the fifth over the right-field wall.

BLUE JAYS 8, YANKEES 1

TORONTO — Ryan Goins successfully pulled off a hidden-ball trick and hit his second career grand slam, leading Toronto over Masahiro Tanaka (12-12) and ensuring New York had to wait at least one more day to clinch a playoff berth.

With Todd Frazier on base following a leadoff double in the third, Jose Bautista made a running catch just in front of the right field warning track on Jacoby Ellsbury’s one-out drive. Goins caught Bautista’s throw while standing near second base, then pretended to toss the ball to pitcher Marco Estrada (10-8) while slipping in into his glove.

Goins turned his back to Frazier, who had returned to the base, and when Frazier briefly lifted his left foot off the base, Goins tagged him on the left thigh. Frazier insisted he had maintained contact with the base, but umpire Mark Carlson called him out to end the inning.

ASTROS 3, ANGELS 0

HOUSTON — Justin Verlander pitched one-hit ball over seven innings to remain perfect with Houston and Yuli Gurriel hit a three-run homer to propel the Astros.

Verlander (14-8) walked two and struck out six to improve to 4-0 since being traded from Detroit on Aug. 31.

Gurriel connected off Yusmeiro Petit (5-2) on his 18th home run to give Houston a 3-0 lead in the seventh.

Chris Devenski pitched a perfect eighth before Ken Giles allowed a hit and a walk with no outs before settling down to finish the inning and pick up his 33rd save.

DIAMONDBACKS 13, MARLINS 11

PHOENIX — Chris Iannetta homered twice and drove in a career-high eight runs, and Arizona outslugged Miami.

J.D. Martinez and Christian Walker also homered for the Diamondbacks, who can clinch their first postseason berth in six years with a win Saturday and a loss by St. Louis.

Arizona erased a 9-7 deficit with five runs in the sixth.

Walker got his first career pinch-homer off Jarlin Garcia to make it 9-8. David Peralta reached on an error before Dustin McGowan (8-2) struck out A.J. Pollock. But Paul Goldschmidt walked and Martinez reached on an infield single ahead of Iannetta, who homered onto the walkway above the center-field fence to put the Diamondbacks ahead 12-9.

Iannetta’s grand slam was his fifth and first since May 28, 2015. He hit multiple homers in the same game for the third time.

J.J. Hoover (2-1) got the win, and Fernando Rodney finished his 39th save.

TWINS 7, TIGERS 3

DETROIT — Max Kepler and Brian Dozier homered, Byron Buxton had three hits and playoff-chasing Minnesota beat Detroit.

Buxton’s two-run double in the fourth put the Twins ahead to stay against a Detroit team that announced before the game that manager Brad Ausmus will not be back in 2018.

Minnesota came into the night leading the race for the American League’s second wild card by 2 ½ games over Texas and the Los Angeles Angels.

Kyle Gibson (12-10) allowed three runs and five hits in seven innings for the Twins. He struck out six and walked two.

Daniel Norris (4-8) allowed five runs and seven hits in 4 2/3 innings.

ATHLETICS 4, RANGERS 1

OAKLAND, Calif. — Rookie Matt Olson hit his sixth home run in seven games, a second-inning drive off Nick Martinez that helped Oakland damage Texas’ playoff hopes.

Olson homered following a leadoff walk to Khris Davis, his 13th home run in September and his 16th in his last 23 games.

Shin-Soo Choo hit his 21st home run for Texas, which has lost six of its last seven at Oakland.

Martinez (3-7) allowed four runs — three earned — and five hits in six innings. He is winless in six starts and four relief appearances since June 25.

Kendall Graveman (6-4) gave up one run, six hits and three walks in seven innings as Oakland won its fifth straight, and Blake Treinen retired three batters for his 10th save.

RED SOX 5, REDS 4

CINCINNATI — Rafael Devers hit a three-run homer and Boston extended its AL East lead to four games by overcoming Scooter Gennett’s fourth grand slam of the season.

Boston added to its lead with the help of the Yankees’ loss at Toronto. The Red Sox have won 12 of 15, keeping the Yankees at bay while moving a season-high 25 games over .500 (89-64).

Rick Porcello gave up Gennett’s fourth grand slam — a Reds’ season record — in the first inning. He lasted a season-low four innings, turning a 5-4 lead over to the bullpen. Porcello has lost 17 games — most in the majors — after winning 22 last year along with the AL Cy Young Award.

Devers hit his shot off Sal Romano (5-7). David Price (6-3) got the victory in relief.

METS 7, NATIONALS 6

NEW YORK — Travis d’Arnaud hit two home runs and New York ended a three-game skid, rallying past a watered-down Washington lineup.

Nationals manager Dusty Baker said he needed to “give my big boys much needed rest” with the playoffs nearing, and not a single regular started for the NL East champions. Star Daniel Murphy pinch hit in the eighth and flied out.

Nori Aoki had three hits for the Mets, including a go-ahead double in the sixth inning off Joe Blanton (2-4). Chasen Bradford (2-0) pitched a scoreless inning for the win.

WHITE SOX 7, ROYALS 6

CHICAGO — Matt Davidson drove in three runs with his 26th homer and a double, Yoan Moncada hit a two-run drive and Chicago overcame a four-run deficit to beat Kansas City.

The Royals dropped 4½ games behind Minnesota for the second AL wild card with nine games left. Jason Hammel (8-13) allowed seven runs and eight hits in 3 1/3 innings.

White Sox rookie Reynaldo Lopez (3-3) allowed six runs — two earned — and 10 hits over 6 1/3 innings to win his third straight start. Juan Minaya pitched a scoreless ninth for his sixth save.

RAYS 8, ORIOLES 3

BALTIMORE — Wilson Ramos hit his third career grand slam, Evan Longoria also went deep and Tampa Bay throttled Ubaldo Jimenez and Baltimore.

Alex Cobb (12-10) earned his career-high 12th win for the Rays, who interrupted a 4-9 slide and kept alive their slim playoff hopes.

Jimenez (6-11) gave up six runs and eight hits in three innings. He was booed lustily by the home fans after each Tampa Bay home run.

BRAVES 7, PHILLIES 2

ATLANTA — Kurt Suzuki homered twice, Nick Markakis drove in three runs and Atlanta beat Philadelphia.

Sean Newcomb (4-8) won his second straight start, allowing two runs in 5 1/3 innings.

Atlanta scored five runs in the first off Ben Lively (3-7) on Ozzie Albies’ RBI single, Markakis’ two-run single and Suzuki’s two-run homer.