LOS ANGELES -- Jon Jay was having a miserable time at the plate until the 12th inning, when he hit a clutch RBI double that made he and his teammates forget all the ugly at-bats that preceded it.
The go-ahead hit sparked a three-run rally for the St. Louis Cardinals, who earned a split of their four-game series against the Los Angeles Dodgers with a 5-2 victory Sunday and regained undisputed possession of the second NL wild-card spot.
"It was a long one and both teams fought hard," Jay said after the 4-hour, 25-minute marathon. "Everyone knows what's at stake right now and we've got our work cut out for us.
"We haven't been playing too well lately, but we've been playing hard. Today we came up with a win on getaway day and it put us back up again. That's huge. But every game from here on out is our most important game. We've been there before, so we know what we've got to do. It's just a matter of doing it."
John Ely (0-2), the ninth of a franchise-record 10 pitchers used by Dodgers manager Don Mattingly, issued a leadoff walk to Matt Carpenter and Jay drove him in from second base with a line drive into the right field corner on an 0-2 changeup.
"Jon had an uncharacteristic day for himself up to that point, but he's been very good this season and filled a big hole for us in the leadoff spot. And today he came through with one of the biggest hits of our year right now," manager Mike Matheny said. "We had a tough time today. You look at that scoreboard and all those Ks, I mean, we had a lot of strikeouts (15), so we just needed somebody to step up."
Jay finished the 2-5 trip 4 for 32 with two RBIs. He struck out his first three times up Sunday and was 1 for 6.
"You've got to stay positive, and that's what I tried to do all day," Jay said. "I tried not to let my other at-bats bother me. I was happy I got a chance to do something to help the team and it worked out. He's got a good changeup, and I was just hoping he'd leave something out over the plate. He did, and I was able to capitalize on it."
Rookie Shelby Miller (1-0) pitched one inning for his first major league victory. Jason Motte got three outs for his 35th save in 42 chances after giving up the tying and winning runs in Saturday night's 4-3 loss.
"If you have a bad day, you want to get back out there and move past the last outing. And I was able to do that today," Motte said. "After something like that, you have to have a short memory because you really don't have a choice. If you re-live every pitch and every out over again every single day, you'll drive yourself insane. I just looked at the video yesterday after the game to see what I did and didn't do."
Both teams have 15 games remaining to settle the wild-card situation. The Cardinals' next nine games are against the Houston Astros and Chicago Cubs, who are a combined 81 games under .500 and 69½ games out of first place. The Dodgers embark on a nine-game trip against East-leading Washington, Central-leading Cincinnati and San Diego before ending the regular season with a six-game homestand against Colorado and West-leading San Francisco.
"We've really been a pretty good road club until that last trip, and we're going to have our hands full again," Mattingly said.
The Dodgers won six of the 11 meetings with St. Louis, and have beaten the Cardinals in consecutive season series for the first time since 1995-96. In case of a tie for the wild card, the Dodgers would get home-field advantage in a one-game playoff.
"We're just taking it one game at a time, and we've got a great chance of being there right at the end," Dodgers center fielder Matt Kemp said. "We're going to be in every game and fight to the end, no matter who we play. We've got a tough road trip coming up, and we'll see what happens. We've got to turn the page and get ready for Washington."
Los Angeles wasted a leadoff double in the sixth by Kemp, who flied out to center field against Fernando Salas with the bases loaded to end the 10th after the right-hander intentionally walked Andre Ethier.
"I have all the respect for all their hitters," Matheny said. "But that particular situation set itself up to get us a little more freedom against Kemp because we didn't have to worry about righty against lefty. So it worked out well."
Ethier tied the score 2-all in the third with his 19th homer, getting the barrel of the bat on a 2-0 pitch that was low and inside and driving it into the pavilion seats in right-center with two outs after a leadoff walk to Matt Treanor.
Right-hander Stephen Fife, making his fourth major league start and first since Aug. 1 in place of injured Dodgers ace Clayton Kershaw, recorded his first six outs on strikeouts. But in-between the first and second ones, the Cardinals took a 2-0 lead as Craig hit an RBI double and Matt Holliday scored on a wild pitch to Molina.
Molina walked, then stole second while David Freese swung at a third strike. Treanor, making his first start behind the plate since Sept. 2, got out of his crouch and headed for the dugout, thinking it was the third out before realizing his mistake. Fife's 31-pitch inning finally ended on a called third strike that had Skip Schumaker fuming at umpire Dana DeMuth.
Fife threw 88 pitches over five innings, allowing two runs and four hits while striking out nine -- two more than he had in his other three outings combined.
Treanor drew a walk all three times up. Dee Gordon pinch-ran for him in the seventh, but Molina threw him out trying to steal. ... The Cardinals have had only six pitchers start a game for them to this point, tying Cincinnati and San Francisco for the fewest in the majors.