Updated

Jon Jay doubled home the go-ahead run in the top of the 12th inning, as the St. Louis Cardinals regained control of the National League's second wild-card spot with a 5-2 win over the Los Angeles Dodgers.

Matt Carpenter walked to start the frame for St. Louis and a Pete Kozma sacrifice advanced Carpenter into scoring position. After Daniel Descalso struck out swinging, Jay delivered by lining a double to right field off John Ely (0-2).

"We needed someone to step up, and Jon Jay came through with one of our biggest hits of the year," Cardinals manager Mike Matheny said.

Carlos Beltran was then intentionally walked and Ely hit Matt Holliday with a pitch before Allen Craig's infield single plated an insurance run. Yadier Molina worked a bases-loaded walk to force in another run.

Jason Motte worked around a one-out walk in the bottom of the 12th to record his 35th save of the season.

The Cardinals, who split this four-game series, hold a one-game lead over Los Angeles in the playoff race.

"We had opportunities...we just couldn't do it," Dodgers manager Don Mattingly said.

Adam Wainwright started for St. Louis and allowed two runs on five hits over six innings. Shelby Miller (1-0) pitched the 11th to pick up his first career win.

Stephen Fife started the series finale in place of Clayton Kershaw, who was scratched with continued right hip pain. The reigning NL Cy Young Award winner is scheduled to visit a specialist on Tuesday.

Fife scattered four hits, walked one and struck out nine in five innings.

St. Louis got an early jump on Los Angeles' rookie right-hander, scoring two first-inning runs. Craig doubled home Carlos Beltran, who had singled with one out before Fife hit Holliday with a pitch. Holliday then hustled home on a wild pitch. A walk to Molina put men on the corners, but Fife struck out David Freese and Skip Schumaker to end the inning.

Los Angeles tied the game in the third on a home run to right-center field by Andre Ethier. Wainwright had issued a leadoff walk to Matt Treanor, who entered play batting .168 and scored on the two-out blast.

Game Notes

The Dodgers failed to score with the bases loaded in the 10th ... Craig has hit safely in 10 straight games ... Fife made his fourth career start.