ST. LOUIS -- Adam Wainwright embraced the stopper role.
The right-hander helped the Cardinals get back on track after a blowout loss, pitching seven strong innings and lifting St. Louis over the San Francisco Giants 3-1 Thursday.
The Cardinals, who have won seven of 10, lost 15-0 to the Giants on Wednesday, their worst home shutout defeat since 1961.
Wainwright (10-10) keyed the bounce-back effort, allowing five hits and one run over seven innings. He struck out seven and walked three. He has given up two earned runs or less in each of his last five starts.
"We needed this win today," he said. "This is kind of what I live for. If there is a challenge out there, I'm ready for it. Not that you need more motivation but (the 15-0 loss) allowed me to focus a little bit more."
Jason Motte pitched the ninth for his 25th save in 29 chances.
Carlos Beltran hit his 27th homer as the Cardinals took a 2-0 lead in the first inning against Madison Bumgarner (12-7).
Beltran, who leads the NL with 80 RBIs, gave Wainwright all the necessary support with a 409-foot drive over the wall in left. Bumgarner has given up 18 home runs -- 15 on the road.
St. Louis manager Mike Matheny told his players to put Wednesday's loss behind them as soon as possible.
Beltran, who has eight first-inning homers, took those words to heart.
"Being able to go out there and score early, it was great," Beltran said. "That's what we needed to do. Yesterday was tough but we were able to bounce back."
Matheny felt Beltran's early home run served to set the tone for the afternoon.
"To get that bad taste out of your mouth is huge," he said. "When we strike first, we've got a real good chance of making something happen.
Jon Jay went 2 for 3 and reached base three times for St. Louis, which completed a seven-game homestand with a 5-2 mark.
Bumgarner allowed just three hits in six innings. He struck out seven, walked one and recorded his sixth successive quality start.
"For the most part, I followed the game plan," Bumgarner said. "And it worked except for a pitch or two."
San Francisco closed to 2-1 in the fifth on a bases-loaded sacrifice fly by Marco Scutaro.
Joaquin Arias and Bumgarner singled with one out before Wainwright walked Angel Pagan. Scutaro, who hit a grand slam and drove in a career-high seven runs Wednesday night, has hit safely in 11 of 13 games since he was acquired from Colorado on July 27. Wainwright then got Melky Cabrera to pop out to end the inning.
St. Louis pushed the lead to 3-1 in the sixth when Jay doubled, stole third and came home on Allen Craig's sacrifice fly.
Giants star Buster Posey extended his season-best hitting streak to 13 games with a single in the sixth.
San Francisco completed a seven-game road trip with a 5-2 record and a split of the four-game series in St. Louis. The teams are each 61-51.
"We had some pretty good at-bats, but today we couldn't get a timely hit," manager Bruce Bochy said. "But, overall it was a very good road trip."
NOTES: Scutaro drove in 12 runs on the trip. ... The Giants had scored in the first inning in each of their previous seven road games before Wainwright stopped them. ... San Francisco has scored 93 runs in 13 games since the All-Star break. ... St. Louis INF Daniel Descalso is in an 0-for-13 slump. ... St. Louis opens a three-game series at Philadelphia on Friday. Kyle Lohse (12-2, 2.79 ERA) will face Roy Halladay (5-6, 4.02). ... The Giants begin a three-game set at home against Colorado. Tim Lincecum (6-11, 5.43) takes on Tyler Chatwood (1-2, 6.61).