Wainwright had one strikeout and did not issue a walk in the victory Monday in St. Louis. He is now 10-9 on the season with a 4.30 ERA.
"It's a tough lineup over there," Wainwright told reporters. "They have a lot of pro hitters and some very talented youngsters over there.
"You have to make your pitches and luckily we did that today."
Kolten Wong got the Cardinals on the scoreboard with an RBI triple in the first inning. Paul Goldschmidt plated Wong in the same inning on an RBI ground out. The Cardinals pushed their lead to 3-0 on a Paul DeJong RBI single in the third frame.
Giants rookie Mauricio Dubon hit his first career home run in the top of the eighth, but San Francisco could not rally to get back into the game.
Giants starter Tyler Beede took the loss after allowing five hits and three runs in four innings. Cardinals relief pitcher Carlos Martinez earned his 17th save of the season by pitching 1 1/3 innings without allowing a hit. Goldschmidt and DeJong each went 1-for-3 with an RBI in the win.
Dubon was the only player to record multiple hits in the game. The Giants second baseman was 2-for-3 with an RBI and a run scored in the loss.
The Giants and Cardinals resume the series at 7:45 p.m. EDT Tuesday in St. Louis.