San Diego starter Clayton Richard (6-10) gave up three hits over five scoreless innings before suffering a brief lapse in the sixth.
Tony Gwynn Jr. led off the sixth as a pinch-hitter for Dodgers' starter Clayton Kershaw and reached on a bunt single. Jerry Hairston then hit a grounder back to the mound and Gwynn was erased on a fielder's choice at second, to bring up Ellis -- who launched a 1-2 pitch for his third homer of the season.
Kershaw (7-5) was credited with the win, having allowed a run on six hits with six strikeouts.
Three Los Angeles relievers worked an inning each. Kenley Jansen came on in the ninth for his 16th save.
Puzzle-maker slips 'Murdoch Is Evil' into Rupert Murdoch's Sunday Telegraph
Exploding whale video goes viral on Internet