Jaime Garcia (7-4) allowed season highs in hits (10) and runs (four) but was effective enough to improve to 4-0 over his past six starts. He did not walk a batter and struck out one, a season low.
Marlon Byrd celebrated his 38th birthday with a pair of doubles, a triple and four RBIs. Kelby Tomlinson also drove in a run for the Giants, who ended a 3-3 homestand.
Chris Heston (11-8) returned to the rotation for the first time in two weeks. He was optioned to Triple A Sacramento but did not pitch in a game, instead throwing two bullpen sessions.
Heston gave up five runs on nine hits in his 3 2/3 innings of work. He did not walk a batter and struck out one, matching his season low.
Kevin Siegrist pitched the ninth for his sixth save.
Carpenter hit the second pitch of the game for a home run as the first four Cardinals reached base safely. Stephen Piscotty singled, Heyward tripled and Molina singled.
The Giants got two runs back in the first on Byrd's first double, but the Cardinals tacked on runs in the third, fourth and sixth.
Byrd, who doubled in a run in the sixth and tripled in another in the eighth, has 11 RBIs in his last four games.
Heyward was a home run shy of the cycle for the second straight Sunday. Piscotty finished the series 7 for 12 with a seven-game hitting streak.
Cardinals: Right-hander Lance Lynn reported no problems with his right ankle, which he injured during Saturday's game. He expects to make his next start.
Link to box score: St. Louis (84-46) 7 at San Francisco (69-61) 5