Luis Cruz tied the game in the final inning and Juan Rivera drove in Cruz for the winning run as the Dodgers downed the Cardinals, 4-3, in the third of four games.

With the win, the Dodgers and Cardinals are now tied for the final wild card spot in the National League.

With two outs in the ninth and Jason Motte (4-5) on the mound, Andre Ethier kept the inning alive with a single to right and Cruz followed with a double just out of the reach and over the head of a diving Jon Jay in center field to tie the game.

Elian Herrera came on to run for Cruz and Rivera stepped to the plate as a pinch hitter. Rivera chipped a shot that just tipped off the glove of a leaping Skip Schumaker at second base and Herrera came home to score for the win.

"I have to be ready every inning," said Rivera. "Every two innings I take swing in our undercover batting cage. He threw me a cutter, middle-away. I thought he caught it. This is exciting."

Mark Ellis hit a solo homer and Adrian Gonzalez drove in a run for the Dodgers, who have won the past two games of this series after dropping four in a row.

"It's a playoff atmosphere here tonight," said Dodgers manager Don Mattingly. "Some great things happened here and it was such a fun time. We're getting everything these guys have in them right now."

Ronald Belisario (6-1) got the win for recording the final four outs while Joe Blanton gave up three runs on four hits with a walk and six strikeouts over 5 2/3 innings in the start.

Allen Craig hit a two-run home run and drove in the other run with a single for the Cardinals, who have dropped five of their last six. Jamie Garcia gave up just two runs -- one earned -- on three hits with one walk and five strikeouts in six innings.

"He had a good outing and his sinker was there all night," said Cardinals manager Mike Matheny about Garcia. "But to lose like this, no one is happy about it."

The Cardinals jumped out to a 2-0 lead in the first when Matt Holliday singled with two outs and Craig followed with his 21st home run of the season.

Los Angeles got one back in the bottom of the inning as Shane Victorino reached base when Daniel Descalso's throw to first went wide, stole second and came home on Gonzalez's single.

Ellis' leadoff homer in the third tied the game, but the Cardinals went ahead in the sixth on Craig's RBI single that scored Garcia.

Yadier Molina started the ninth with a double off the wall in center that Matt Kemp made a leaping attempt on. Molina, though, tried to stretch it out to a triple and Kemp gunned him down.

Game Notes

Los Angeles has won six of the 10 games against St. Louis this season ... Los Angeles batted 3-for-7 with runners in scoring position ... The Dodgers announced during the game that starter Clayton Kershaw will miss Sunday's start due to right hip pain and that he will see a specialist in New York on Tuesday.