ST. LOUIS (AP) One big swing for Matt Carpenter put it away for the St. Louis Cardinals.
This time, the Pittsburgh Pirates had no chance for another rally.
Carpenter hit a tiebreaking two-run homer in the ninth inning, lifting the Cardinals to a 6-4 victory over the Pirates on Saturday.
''It's awesome being able to win the game like that, especially the way it played out beforehand,'' Carpenter said. ''That was a big win.''
Pittsburgh tied it at 4 in the top of the ninth when Starling Marte hit a ground-rule double off Trevor Rosenthal (1-1) with runners on first and third. Francisco Cervelli then grounded out to end the inning.
If Marte's drive had not bounced over the left-field fence, Gregory Polanco would have had a chance to score.
''I don't think there's any doubt that he scores had that ball stayed in the ballpark,'' Pirates manager Clint Hurdle said. ''That's the definition of a bad bounce.''
Aledmys Diaz sparked the winning rally with a leadoff single. After Jeremy Hazelbaker flied to deep left, Carpenter drove a 1-2 pitch from A.J. Schugel (0-1) over the wall in right for his fourth homer.
Carpenter said it was his first game-ending hit since he played for Double-A Springfield in 2012.
''We can cross it off the list now,'' he said.
It was the Cardinals' first win over the Pirates in five games this season. It also was a sweet ending for Diaz, who committed a costly error in the top of the ninth.
Cardinals right-hander Adam Wainwright allowed three runs and seven hits, struck out five and walked none in 6 1/3 innings. Wainwright, who has struggled in the first part of the season with a 6.30 ERA, said his curveball started to click when he struck out Cervelli after the first four Pirates reached in the first.
''That was a huge out. It was a 3-2 curveball I threw with a newly found confidence in that pitch I had not had,'' Wainwright said. ''It's good to be back. That was me out there.''
He also doubled in the second to become the first Cardinals pitcher in the modern era with extra-base hits in four straight plate appearances covering his past three starts. He grounded out in the fifth.
Jeff Locke pitched six innings for Pittsburgh, allowing three runs and four hits.
The Pirates tied it at 3 on John Jaso's two-out RBI single in the seventh on an 0-2 pitch from off Seung Hwan Oh. The Cardinals went back in front on Randal Grichuk's RBI single in the eighth, setting up the frantic finish.
HOMETOWN HERO WELCOME
Pirates third baseman David Freese, a St. Louis native who played a key role in the Cardinals' 2011 World Series championship, was given a standing ovation when he pinch-hit in the ninth inning. Freese reached on Diaz's error and scored the tying run.
Plate umpire Dana DeMuth left after the second inning to be evaluated for a possible concussion. DeMuth was hit in the mask by a foul ball in the first. Ed Hickox moved from second base to behind the plate and three umpires called the rest of the game. The change led to an 11-minute delay.
Pirates: 3B Jung Ho Kang was in the lineup for a day game the night after making his season debut in his return from a knee injury last September.
Cardinals: Because of an off day, the rotation could be shuffled to give RHP Carlos Martinez (fatigue) two extra days' rest before his next start. Martinez, who has been dealing with flu-like symptoms for the past week, left his start Friday in the fourth inning.
Pirates: RHP Gerrit Cole (2-3, 3.95 ERA) gave up six runs for the first time in his career in his previous start, a 7-2 loss to the Cubs on Monday. He beat the Cardinals three times in four starts last year, posting a 2.39 ERA.
Cardinals: RHP Michael Wacha (2-2, 2.65 ERA) was roughed up by the Pirates in his first start of the season, allowing 10 hits and five runs in 4 1/3 innings. Wacha held the Phillies to one run in eight innings in a 1-0 loss on Tuesday.