The Giants are 18-2 at home against Arizona since the start of the 2020 season. They've also won seven of their last nine games.
''The energy has been much better in here,'' Longoria said.
San Francisco took control and broke open a scoreless game by scoring all of its runs in the fourth, fifth and sixth innings.
Diamondbacks starter Madison Bumgarner (6-12), the Giants' 2014 World Series hero, allowed all six runs and eight hits in 5 2/3 innings while walking two and striking out six. Bumgarner made just his second Oracle Park start with fans in the stands. He started once in San Francisco in 2020, with only cardboard cutouts in the seats due to COVID-19 restrictions.
On Monday, Bumgarner received a warm ovation from the crowd as he left the mound.
''I'm not going to lie to you and say to you it's just any other game in any other stadium,'' Bumgarner said. ''I especially want to pitch well here and just didn't. It's frustrating. ... It's embarrassing is how I'd describe it. I definitely made some bad pitches, but I made some bad pitches in the first few innings, too. It wasn't like I was as good as I could be out there, but I would like to have been able to have better results.''
Longoria followed J.D. Davis' one-out double and broke a scoreless tie with his 10th homer of the season, a drive into the left-center field stands. Longoria has 14 double-digit home run seasons. The 13 he accumulated before this season ranked him tied for sixth among active players.
After extending their lead to 3-0 in the fifth on Joey Bart's double and Austin Slater's RBI single, the Giants chased Bumgarner with three runs in the sixth. Davis' leadoff single and Longoria's walk set up the outburst. Thairo Estrada hit a double that scored Davis with one out and preceded Bart's two-run double.
Bart is batting .500 (14 for 28) during a career-best seven-game hitting streak.
''He'll be placing himself in a category of his own,'' Longoria said of Bart, who has begun to display the maturity that the Giants expected from him when they drafted him second overall in 2018.
Cobb (4-6) struck out five in six innings and allowed five hits, including Christian Walker's sixth-inning homer, his 28th of the season.
Diamondbacks: Right fielder Daulton Varsho returned to the lineup, batting leadoff, after being hit in the jaw by a wayward between-innings throw from third baseman Josh Rojas ... Ketel Marte did not start Monday, allowing him to rest his tight left hamstring. His playing status remained day to day.
Giants: Outfielder Joc Pedersen did not start, but was considered available after taking batting practice. Pedersen proved he was physically sound by rapping a pinch-hit double in the seventh. Pedersen was hit on his right pinkie by a pitch from Pittsburgh's Zach Thompson on Sunday. Giants manager Gabe Kapler said that X-rays taken on Pedersen's finger were negative. ... Monday was deemed a day of rest for shortstop Brandon Crawford, who left the injured list on Aug. 7 after coping with left knee inflammation.
The Giants and Diamondbacks continue their four-game series at Oracle Park on Tuesday. Arizona ace Merrill Kelly (10-5) will oppose San Francisco right-hander Jakob Junis (4-3).
More AP MLB: https://apnews.com/hub/mlb and https://twitter.com/AP-Sports
Copyright 2022 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.