The Cardinals snapped the Giants' three-game winning streak, capitalizing on three San Francisco errors to score four unearned runs.
St. Louis has won seven out of nine games.
Kyle Lohse (2-0) was scored on for the first time in three starts this season but still picked up the victory, allowing two runs on eight hits in 5 1/3 innings.
Barry Zito (0-3) suffered the loss, although only one of the four runs he gave up over six innings was earned.
San Francisco had a 2-1 lead going into the fifth but a key error allowed St. Louis to move in front. Cesar Izturis singled off Zito with one out and Skip Schumaker reached first on a fielding error by second baseman Ray Durham.
After Brian Barton struck out for what should have been the third out of the inning, Pujols homered to left for three unearned runs.