PHOENIX -- In his brief major league career, Arizona's Patrick Corbin never had pitched longer than seven innings, driven in a run or had an extra-base hit.
The rookie left-hander accomplished all three Sunday.
Corbin (6-7) pitched eight innings and drove in four runs with a triple and single in the Diamondbacks' 10-2 rout of the San Francisco Giants.
Justin Upton had a solo homer and two-run double as the Diamondbacks averted a three-game sweep.
Corbin entered the game batting .071 (2 for 28), then struck out in his first at-bat against Ryan Vogelsong.
His next time up, with the bases loaded, he tripled down the line into the right field corner, breaking open what had been a 2-2 game.
"My first at bat he threw two heaters in and I just stood there, didn't even take the bat off of my shoulder," Corbin said. "He got to two strikes again and that's just what I was sitting on. I just put the bat on the ball and it got by them."
Arizona manager Kirk Gibson said the Giants had just moved first baseman Brian Belt off the line the pitch before Corbin's hit.
"We saw Patrick earlier in the year swinging the bat very well," Gibson said. "He hasn't lately, but he had a huge day at the plate."
Corbin scattered eight hits, striking out five and walking one.
For the second straight start against Arizona, Vogelsong (12-9) lasted only 3 1/3 innings. He allowed seven runs, six earned, on five hits with six strikeouts and four walks, one intentional.
"I can't say I missed location today. The only pitch I missed location was Upton's first double," Vogelsong said. "On Corbin's (triple) I just spotted it in the middle. The balls came out good that is why it is getting perplexing. My stuff is there. It just doesn't make much sense right now."
Vogelsong gave up four runs in five innings against Colorado in his last start. Before that he was tagged for six runs in 3 1/3 against Arizona. He has given up 20 runs in his past four starts and 34 in his last seven.
"His stuff is good, he is just going through a tough period," San Francisco manager Bruce Bochy said. "He has been through it before and he will come out if it."
NL West-leading San Francisco had not allowed this many runs since a 14-2 loss to Washington on Aug. 13.
The victory keeps Arizona 4½ games out in the wild-card race. San Francisco remains 7½ up in the NL West over the Los Angeles Dodgers, who lost 5-2 to St. Louis in 12 innings.
Corbin threw 93 pitches and acknowledged he wanted to go back out for the ninth. But Gibson said that Corbin had been stretched beyond where he'd been this season and Josh Collmenter needed the work in the ninth.
Arizona's fourth-inning eruption broke a 2-2 tie.
It started when Giants shortstop Joaquin Arias muffed Paul Goldschmidt's grounder. Vogelsong struck out Ryan Wheeler for the second time, but Cody Ransom doubled off the wall in center to put runners at second and third. Gerardo Parra was walked intentionally to bring up Corbin, who was batting .069 (2 for 29).
On a 1-2 pitch, Corbin hit one down the line to the right field corner, clearing the bases and finishing with a head-first dive into third.
Upton homered for the second game in a row, a solo shot to left in the sixth. Corbin got his fourth RBI with a broken-bat, bloop single in the seventh.
The four RBIs were the second-most by a pitcher in Diamondbacks' history. Micah Owings had six against Atlanta on Aug. 18, 2007.
Arizona went up 2-1 in the third on Upton's booming two-run double off the overhang in right-center, a foot or less shy of a home run. Vogelsong retired the first two batters in the inning but walked Eaton and gave up a single to Hill to set things up for Upton, who also had a solo home run in the sixth.
The Giants go home for a four-game series with Colorado. LHP Madison Bumgarner (14-10, 3.32 ERA) goes for San Francisco in Monday's opener and Jhoulys Chacin (2-5, 4.86) for the Rockies. ... Arizona has Monday off. The Diamondbacks open a three-game series at home with San Diego on Tuesday, RHP Ian Kennedy (13-11, 4.21) going for Arizona, LHP Eric Stults (6-2, 2.54) for the Padres. ... San Francisco finished its road trip 4-2. .... The Giants haven't lost a series on the road since dropping two of three at Pittsburgh July 6-8. ... The Diamondbacks had not scored more than four runs in 12 straight home games, tying a club record. ... Upton has homered in consecutive games for the first time since he had one in three straight games last Sept. 7-9. ... The Diamondbacks only outhit the Giants 9-8. ... San Francisco used eight pitchers.