LOS ANGELES -- Since manager Don Mattingly had a few choice words for his team last week in San Diego, the Los Angeles Dodgers aren't going away quietly.
Elian Herrera singled in the go-ahead run with the bases loaded in the bottom of the ninth inning, lifting the Dodgers to a 3-2 victory against the NL West champion San Francisco Giants on Monday night that kept their postseason hopes alive.
"It's really exciting," Herrera said, grinning after his first career walk-off hit and fourth game-winning RBI of the season. "They are playing so good. They just have to keep playing like that."
|More on Giants-Dodgers|
|More MLB coverage|
The Dodgers' sixth consecutive victory tied a season high and kept them two games behind St. Louis for the second NL wild card. Their victory prevented the Cardinals from clinching a playoff berth after St. Louis beat Cincinnati 4-2. The Dodgers and Cardinals each have two games remaining.
"Hopefully the Reds can get out to a good lead and turn it over to their bullpen, which is very strong," A.J. Ellis said.
Los Angeles' winning streak began after opening a three-game series in San Diego with a 2-1 loss last Tuesday. Mattingly talked to his players in a meeting described by Ellis as "pretty tough."
"He called us on the carpet," Ellis said. "Since then, guys have looked themselves in the mirror stronger."
Mattingly's message involved having "players take more accountability," the catcher said.
"I'd like to be clinched at this point," Mattingly said. "But the guys have kept fighting. We'll take care of our business and hope for help."
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. Ellis was intentionally walked and Herrera lined an 0-1 pitch off the glove of second baseman Marco Scutaro for the winning run.
"That ball was smoked," Giants manager Bruce Bochy said of Herrera's liner. "We were in a tough situation there. Marco made a great effort."
Brandon League (2-6) got the victory after pitching a scoreless ninth inning.
"The energy has really picked up this week," Dodgers starter Aaron Harang said.
The Giants tied the game at 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 home runs in his previous two games.
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.
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. He finished the regular season with his lowest career ERA of 3.61.
Cain gave up two runs and four hits in five innings, struck out two and walked one. He is scheduled to start the Giants' playoff opener.
"It was a good overall season, but it's something that I don't want to be sitting on," he said. "I want to have a good bit more starts in the postseason."
- Ethier's home run was the first Cain has allowed since Sept. 2 against the Chicago Cubs, a span of 30 1/3 innings.
- Ethier has 20 or more home runs for the fourth time in five seasons.
- The Giants saw their three-game winning streak at Chavez Ravine snapped.
- 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 because of back spasms.
- Cain turned 28 on Monday.