PHOENIX – The Los Angeles Dodgers became the first team to clinch a postseason berth, wrapping up their first NL West title since 2009 when they rallied past the Arizona Diamondbacks 7-6 on Thursday behind two homers from Hanley Ramirez.

The Dodgers got off to an 30-42 start and were last in the division, 9½ games behind the first-place Diamondbacks, before play on June 22. Los Angeles has gone 58-23 since.

PIRATES 10, PADRES 1: Neil Walker had four hits to lead host Pittsburgh over San Diego and stop a three-game losing streak.

ROCKIES 7, CARDINALS 6: Corey Dickerson’s RBI triple with one out in the bottom of the 15th gave Colorado the win at home.

GIANTS 2, METS 1: Madison Bumgarner struck out 10 in seven innings of four-hit ball as San Francisco won at New York.

CUBS 5, BREWERS 1: Luis Valbuena, Nate Schierholtz and Brian Bogusevic homered, and Chicago won at Milwaukee to stop a five-game losing streak.

NATIONALS 3, MARLINS 2: Bryce Harper hit a three-run homer and host Washington kept alive its slim playoff hopes.

AMERICAN LEAGUE

RANGERS 8, RAYS 2: Elvis Andrus drove in three runs and Texas won at Tampa Bay for a four-game series split that left the teams tied atop the AL wild-card race.

The Rays and Rangers each have 10 games left. The Indians, who have nine remaining, pulled within a half-game of the leaders.

INDIANS 2, ASTROS 1: Matt Carson hit a winning single with two outs in the 11th inning.

TIGERS 5, MARINERS 4: Victor Martinez’s double scored Prince Fielder from first in the seventh inning, sending host Detroit over Seattle. It was the second double of the game for Martinez, who is hitting .367 since the All-Star break.

BLUE JAYS 6, YANKEES 2: New York stumbled again in what appears to be an increasingly futile September, losing at Toronto for its fifth defeat in six games.