The Dodgers took a 3-0 lead in the third inning on a three-run home run by Hanley Ramirez off Diamondbacks starter Wade Miley, who allowed three runs on five hits in five innings.
Scott Van Slyke and Michael Young each drove in a run in the sixth and Ramirez led off the seventh with his second home run of the game -- his 20th of the season -- off Arizona's Chaz Roe to tie the score at 7-7.
Ramirez finished 4-for-5 with two home runs and four RBI.
Ellis' home run off Josh Collmenter in the eighth out LA up 7-6 and the Dodgers went on to wrap up their first division title since 2009 and became the first MLB team this season to clinch a playoff spot.
Gal Gadot cast as Wonder Woman for 'Batman vs. Superman'
Exploding whale video goes viral on Internet