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 Arizona, 7-6, on Thursday behind two homers from Hanley Ramirez.

Despite an NL-high payroll of $214 million-plus on opening day, the Dodgers got off to a 30-42 start and were last in the division, 9 1/2 games behind the first-place Diamondbacks, before play on June 22. Los Angeles has gone 58-23 since.

The Dodgers trailed 6-3 in the sixth and A.J. Ellis hit a tiebreaking homer off Josh Collmenter (4-4) leading off the eighth. Ramirez, who sat out five of the last six games with an irritated nerve in his lower back, hit a three-run homer in the third inning and a tying solo shot in the seventh.

ROCKIES 7, CARDINALS 6: Corey Dickerson’s RBI triple with one out in the bottom of the 15th inning gave Colorado the win in a tie for the second-longest game in Coors Field history. Matt Holliday had three hits for the Cardinals, who had their NL Central Division lead over Pittsburgh trimmed to one game. The Cardinals loaded the bases in the 15th but Pete Kozma hit into a double play to end the inning.

NATIONALS 3, MARLINS 2: Bryce Harper hit a three-run homer to back an effective pitching performance by Gio Gonzalez, and Washington kept alive its slim hope of reaching the playoffs. Despite winning 11 of 13 in a belated run, the Nationals trail Cincinnati by five games for the final NL wild-card slot with nine games remaining. Denard Span went 0-for-4 for Washington, ending his hitting streak at 29 games — one short of the Nationals record.

RED SOX 3, ORIOLES 1: Boston clinched its first postseason berth since 2009 behind John Lackey’s two-hitter. Coming off a last-place finish and a 69-93 record — their most losses since 1965, the Red Sox have rebounded under first-year manager John Farrell and ensured at least a wild-card berth in the postseason. They lowered their magic number to two for clinching the AL East.

RANGERS 8, RAYS 2: Elvis Andrus drove in three runs and Texas beat Tampa for a split of their four-game series that left the teams tied atop the AL wild-card race. The Rangers won the season series with the Rays 4-3, earning home-field advantage should the teams finish in tie for the two wild-card spots. They each have 10 games left.

INDIANS 2, ASTROS 1: Matt Carson’s single with two outs in the 11th inning gave Cleveland the win as it closed within a half-game in the AL wild card race.

BLUE JAYS 6, YANKEES 2: New York lost for the fifth time in six games. Hiroki Kuroda lost his fifth straight decision, allowing two runs in the third inning and a solo home run to Anthony Gose in the sixth.

TIGERS 5, MARINERS 4: Prince Fielder had three hits and scored the tiebreaking run in the seventh inning on a close play at the plate for Detroit. The Tigers trailed 4-3 after Seattle’s Dustin Ackley hit a three-run homer in the fifth, but Fielder’s RBI single in the seventh tied it. Then he scored from first when Victor Martinez doubled off Charlie Furbush.

ATHLETICS 8, TWINS 6: Coco Crisp hit a go-ahead two-run homer in the eighth inning, and Oakland lowered its magic number to clinch the AL West to four. Brian Dozier hit a tying RBI single in the top half of the eighth, then Oakland rallied once more just as this club has done so many times the past two seasons. Crisp connected for his 21st home run off Shairon Martis (0-1). Jed Lowrie’s three-run homer put the A’s ahead 6-3 in the sixth after pinch-hitter Alberto Callaspo tied it with a solo shot, but the bullpen couldn’t hold the lead.