Salas walked pinch-hitter Elian Herrera to open the inning and Adam Kennedy singled with one out to send Herrera to third.
James Loney was walked intentionally to load the bases, bringing up Ellis. Salas missed the strike zone four straight times to force in the winning run.
Kenley Jansen (3-0) got the win despite giving up the tying homer to Berkman during his one inning of work.
In a meeting of division leaders, the Dodgers won at home for the 17th time in 21 games this season.
St. Louis overcame an early 3-0 deficit with a four-run third that featured Matt Holliday's two-run homer.
The Dodgers, however, tied it in the bottom of the third on a run-scoring single from Kennedy and the game remained deadlocked until Los Angeles scratched out a run in the seventh that was driven in on a single by Loney.
2014: The Year in Music [PHOTOS]