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.

Despite an NL-high payroll of $214 million-plus on opening day, 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.

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. J.P. Howell (2-1) got two outs for the victory. P