SAN DIEGO -- The San Francisco Giants needed this win badly.
Coming on the heels of Wednesday's news that leading hitter Melky Cabrera had been suspended for 50 games for testing positive for testosterone, San Francisco was reeling.
After an off day on Thursday following 20 straight games, the Giants rebounded in a big way.
"What happened on Wednesday was tough for all of us, kind of a shock for all of us," Cain said. "But that's the thing about baseball, you have to turn the page. I think the guys have done a good job of that."
San Francisco lost at home to Washington on Wednesday shortly after learning of Cabrera's suspension.
"It's important that you are resilient in this game," Giants manager Bruce Bochy said. "With what has happened, it was important that we come out and play well, and the fellas did. We have to move on and that's what the guys are doing."
Cain (12-5), who pitched a perfect game on June 13, surrendered one run on four hits. The right-hander didn't allow his first hit until Yonder Alonso's one-out double in the fifth. Alonso scored one out later on Everth Cabrera's single.
"He was hitting his spots," Bochy said. "He had all his pitches going. He's tough when he's on and he was on (Friday)."
Cain, 6-0 in nine starts following a San Francisco loss, struck out six and did not walk a batter.
"He threw a lot of strikes," Padres rookie catcher Yasmani Grandal said. "He throws everything for strikes. He just keeps you off balance. He was real tough."
The Giants moved one-half game ahead of the Los Angeles Dodgers, who lost 4-3 in 11 innings at Atlanta. San Francisco had been in first place for 32 consecutive days before Wednesday's loss to the Nationals.
Scutaro hit a solo homer in the first inning before San Francisco's season-high scoring output in the third off Ross Ohlendorf (4-4) and reliever Nick Mikolas.
One of the Giants' biggest concerns moving forward, was how they would replace Cabrera's .346 batting average, 11 homers and 60 RBIs. But for one game, they had the answer.
"We have a great team and a good group of guys," Cain said. "All these guys know what they can do. It's just a matter of us putting it together and focusing on that."
The Giants' eight runs came on eight hits, including two doubles and a triple, along with two walks and a passed ball as they sent 13 batters to the plate.
"This park is tough to score runs in," Bochy said. "But if you put the bat on the ball, good things are going to happen."
Ohlendorf gave up a leadoff double in the inning before getting an out. He then allowed the next six batters to reach safely before getting pulled for Mikolas.
Ohlendorf allowed a career-high eight runs on six hits in 2 1/3 innings. The right-hander, who gave up seven runs in three innings of Sunday's 11-5 loss at Pittsburgh, saw his ERA rise from 6.41 to 7.58.
San Francisco has won 18 of the last 24 meetings with the Padres.
San Diego, outscored 18-1 while losing the final three of a four-game series at Atlanta that ended on Wednesday, had its four-game home winning streak snapped. The Padres had won 10 of 12 at home.
"You're going to have stretches like this," San Diego manager Bud Black said. "But you have to realize these things happen over the course of a season."
In Ohlendorf's last start, Pittsburgh scored nine runs in the fourth inning, six off against Ohlendorf. ... San Francisco has won 10 of its last 14 road games since the All-Star break, outscoring its opponents by a 103-45 margin. ... The Giants recalled OF Justin Christian and RHP Eric Hacker from Triple-A Fresno on Friday. RHP Dan Otero was optioned to Fresno. ... San Diego activated rookie C Yasmani Grandal (strained right oblique) from the 15-day DL. C Nick Hundley (bruised right knee) was placed on the 15-day DL. ... Giants LHP Barry Zito (9-8, 4.29 ERA) faces off against Padres LHP Eric Stults (3-2, 2.45) on Saturday night.