A.J. Ellis drew a four-pitch, bases-loaded walk in the ninth inning Friday to give the Los Angeles Dodgers a 6-5 win over St. Louis.

St. Louis tied the game in the top of the ninth on a two-out homer by Lance Berkman, but wildness by Fernando Salas in the bottom half of the inning led to a Los Angeles win.

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.