LOS ANGELES -- Elian Herrera singled in the go-ahead run in the bottom of the ninth inning, lifting the Los Angeles Dodgers to a 3-2 victory over the San Francisco Giants on Monday night that kept their postseason hopes alive.
The Dodgers' sixth consecutive victory tied a season high and kept them two games behind St. Louis for the second NL wild card. Their win prevented the Cardinals from clinching a playoff berth after St. Louis beat Cincinnati 4-2. The Dodgers and Cardinals each have two games remaining.
Hanley Ramirez led off the ninth with a single off Santiago Casilla (7-6), advanced on a sacrifice by Shane Victorino and was held up at third on Luis Cruz's single. A.J. Ellis was intentionally walked and Herrera lined an 0-1 pitch off the glove of second baseman Marco Scutaro for the winning run.
Brandon League (2-6) got the win.
The Giants tied the game 2-2 in the eighth. Angel Pagan doubled to deep right with one out, and Scutaro singled off Kenley Jansen and took second on the throw. Scutaro extended his hitting streak to a major-league and career-best 18 games.
After scoring 18 runs in a three-game sweep of Colorado, the Dodgers' offense stalled. Slugger Matt Kemp went 0 for 4 after hitting homers in his previous two games.
Los Angeles rallied to take a 2-1 lead in the fourth. Andre Ethier hit his 20th homer -- a two-run shot -- on the first pitch from Matt Cain after Mark Ellis singled to open the inning.
San Francisco led 1-0 in the first on Buster Posey's double to deep left field with two outs, scoring Scutaro who had walked.
Dodgers starter Aaron Harang allowed one run and two hits in six innings, struck out three and walked two while facing the Giants for the first time this season.
Cain gave up two runs and four hits in five innings. He struck out two and walked one.
NOTES: Dodgers 1B Adrian Gonzalez hit his career-high 47th double in the sixth, extending his hitting streak to 13 games, tops on the club this season. ... Posey was replaced by Eli Whiteside in the bottom of the eighth. ... Cain turned 28 on Monday.