PITTSBURGH -- Adam Frazier boiled down his first career walk-off hit to its simplest terms.
"The best part is that you don't have to go to extra innings and you win the game," Frazier said Sunday after his RBI single gave the Pittsburgh Pirates a 4-3 win over the St. Louis Cardinals at PNC Park.
"To get it done right there is pretty big. I'm pretty excited to come through for the team right there."
Pittsburgh scored twice in the ninth inning on an RBI double by Jordy Mercer and Frazier's RBI single to center, both against reliever Brett Cecil (1-3) after St. Louis twice erased one-run deficits.
Pittsburgh (44-48), fourth in the National League Central, won the series with two walk-off victories during the weekend and moved within a half-game of third-place St. Louis (44-47).
"We hung around," Pirates manager Clint Hurdle said. "We gave up two leads (Sunday), battled back and had a nice strong ninth inning with some good at-bats.
"I'm proud of the men, and I'm proud of the fight. A good series to start the second half."
The ninth opened with Pittsburgh trailing 3-2. Francisco Cervelli got an infield single when shortstop Paul DeLong could not come up with a sharp shot, giving the Pirates hope.
"Paul even said, 'Hey, I'm sorry I didn't make that play,'" Cecil said. "I said, 'You don't need to make the play. It's going to be a tough play regardless. It's just unlucky.'
"I told him I could have made better pitches, too. It's just one of those things. If he makes it, it's a great play. Just unlucky."
Josh Harrison, pinch-running for Cervelli, went to second on Gregory Polanco's groundout and scored on Mercer's double to the corner in left. After pinch-hitter Jose Osuna grounded out and pinch-hitter David Freese was intentionally walked, Frazier drove in the winner.
"The only pitch I really wish I could have back is, obviously, that last pitch, a curveball that just kind of hung out over the plate," Cecil said.
The pitch was half the equation.
"It's a good swing," Hurdle said. "It's left on left. He let the ball travel. It's hard back up the middle."
Wade LeBlanc (4-2) pitched the ninth for Pittsburgh for the win.
Magneuris Sierra was 4-for-4 with an RBI for St. Louis, with his speed helping him notch three infield singles.
"I'm definitely aware that my speed can cause the other team some damage and help my team," said Sierra, who was recalled Saturday and started Sunday. "As soon as I make contact, I really take advantage of the opportunity to get on base."
His four were among 13 hits for the Cardinals.
Trevor Williams, making his first career start against the Cardinals, allowed two runs and 10 hits in 5 2/3 innings with five strikeouts and two walks. He just missed his fourth quality start in his past five outings.
Cardinals starter Carlos Martinez made his 13th quality start, allowing two runs and five hits in seven innings.
Andrew McCutchen's 1,400th career hit gave the Pirates a 1-0 lead in the first inning. His one-out single up the middle drove home Frazier, who led off with a bloop single and stole second.
St. Louis tied it in the fifth when Sierra reached on an infield single, advanced on Martinez's bunt and scored on Matt Carpenter's double to the corner in right.
Light-hitting Max Moroff sent Martinez's first pitch of the fifth off the foul pole in left for his first major league homer and a 2-1 Pittsburgh lead.
"That's the beautiful part about the game," Hurdle said. "You just find ways to give men opportunities from time to time. You see what they can do with them.
"It just shows that if he's up there, he's going to fight. He put a real good swing on a good pitch."
St. Louis tied it again in the sixth on Kolten Wong's one-out single, Sierra's infield single an out later and Martinez's RBI base hit up the middle. That chased Williams.
Yadier Molina's home run to left in the eighth gave the Cardinals their first lead at 3-2. It was the first homer of the season given up by Pittsburgh reliever Juan Nicasio.
NOTES: RF Magneuris Sierra's infield single in the second inning gave him the distinction of being the first St. Louis player to hit safely in his first nine major league games. He was recalled Saturday from Double-A Springfield. ... Pittsburgh RHP and starter Trevor Williams' single to right field in the third inning was his first major league hit after starting his career 0-for-22. ... 2B Josh Harrison, the Pirates' representative at the All-Star Game last week, and 3B David Freese were given the day off from the starting lineup.