ST. LOUIS -- Foremost on Kolten Wong's mind as he stepped to the plate with two outs in the ninth inning of Tuesday night's tie game was getting an opportunity to run. He hoped to be the spark plug, to find a way on base so that on-deck hitter Allen Craig could send him scampering home.
Craig never got to swing.
Turning on a full-count fastball from Pirates reliever Ernesto Frieri, Wong gave the Cardinals a dose of déjà vu with a walk-off homer into the right-field stands. The blast, which gave the Cardinals a 5-4 win, landed in nearly the same spot as Matt Adams' a night earlier, when he became the first Cardinal to hit a walk-off home run since 2011.
It took only 23 hours and 10 minutes to repeat the feat.
"This year has been such a roller coaster for me -- up and down, up and down," Wong said. "To finally get this to happen -- this is one of the top things that has happened to me in my career. It's awesome."
With wins in each of the first two games of this series, the Cardinals have knocked the Pirates from second to fourth in the National League Central. At the same time, they've climbed to within three games of the first-place Brewers, the closest they have been to the top of the division since May.
To make this latest push behind the long ball adds a twist, too, as the club ranks last in the NL in homers, with 54. They last enjoyed back-to-back walk-off homers in 2011, when Albert Pujols hit them on consecutive June days against the Cubs.
"We still aren't necessarily catching the league lead in [homers], but they're going to happen," manager Mike Matheny said. "And they're going to happen when you least expect it and are going about it the right way."
Even before he stepped to the plate in the ninth, Wong had sparked the Cardinals' offense, having followed two-out singles by Jhonny Peralta and Oscar Taveras with a bases-clearing double off Pirates starter Vance Worley in the second. Matt Holliday contributed a two-run double in the fifth after the Pirates had inched in front with a pair of homers.
The Cardinals had just one hit over the next three innings, and Frieri opened the ninth by retiring the first two batters. Frieri then jumped ahead, 0-2, before Wong worked the count full.
Then Wong anticipated the fastball.
"I was either going to get that pitch or strike out, because I was swinging at something hard," he said. "If he would have thrown something else, I probably would have been in trouble."
The homer was Wong's second in three games since coming off the disabled list after dealing with a shoulder injury that inhibited his ability to follow through on his swing.
"As you can see, my swings are a lot more aggressive now," he said. "Just having that in my mind, knowing I can swing the bat without having any pain, it brings a lot of calmness to me and comfort in my swing."
With four hits in 10 at-bats, he seems to be proving his point -- and at just the right time. As the Cardinals seek to improve their offense, they are looking externally at options for second base. A healthy Wong could give them the internal answer they'd prefer.
"What he has is bat speed, and that's one of those things you can't teach," Matheny said. "It's a gift he has, and I hope it's something he continues to trust, as it will make him a better hitter."
Like Adam Wainwright a night earlier, starter Carlos Martinez did not have one clean inning out of his six, but he worked around an avalanche of trouble by keeping the Pirates hitless with runners in scoring position. In the series, Pittsburgh is 0-for-17 in such spots.
"We've come off five, six weeks of good offensive baseball, and we're just not getting the hit to pop something loose," Pirates manager Clint Hurdle said. "We've just got to keep going out there."
Pedro Alvarez did tag Martinez for a game-tying homer in the fourth. Andrew McCutchen then provided Pittsburgh with a short-lived lead when he homered an inning later.
Defensive help helped Martinez avoid further blemishes. Yadier Molina's quick throw erased Neil Walker at third base after Walker followed McCutchen's blast with a one-out triple.
"A momentum-shifter," Matheny called it.
An inning later, center fielder Jon Jay robbed Ike Davis of extra bases with a leaping grab at the warning track. Martinez finished that frame, giving him the first six-inning start of his career. The Cardinals have won all five games he started since joining the rotation.
"I'm learning to keep the pitches low in the zone and use all my pitches, then start to work down in the zone with all my pitches," Martinez said, with bullpen catcher Roberto Espinoza translating. "Just follow those plans."
Four relievers combined to follow Martinez with three scoreless innings, though Trevor Rosenthal had to work out of another self-induced mess to finish his, closing the top of the ninth with a strikeout of Starling Marte.
Jenifer Langosch is a reporter for MLB.com. Read her blog, By Gosh, It's Langosch, and follow her on Twitter @LangoschMLB. This story was not subject to the approval of Major League Baseball or its clubs.