PHOENIX (AP) Tim Hudson pitched six effective innings in his return to the rotation and hit his first homer in two seasons, lifting the San Francisco Giants to a 6-2 victory over the Arizona Diamondbacks on Tuesday night.

Hudson (7-8) was sharp while subbing for Ryan Vogelsong, who pitched in relief the night before. Hudson allowed a run and four hits in his first start since July 26.

He helped with his bat, too, hitting a solo homer in San Francisco's five-run third inning off Chase Anderson (6-6) and later added a single.

More from FoxSports

Gregor Blanco and Joe Panik also homered in the third for the Giants, who won for the third time in 11 games as they try to make up ground on the Los Angeles Dodgers in the NL West.

Jarrod Saltalamacchia homered for the Diamondbacks.

Hudson struggled before going on the disabled list with a shoulder strain, posting a 5.63 ERA in six previous starts. He was reinstated on Sept. 1 and made two relief appearances.

Hudson was cruising before the Diamondbacks scored a run in the fourth on Jake Lamb's sacrifice fly after three straight singles. David Peralta was thrown out after rounding third too far to end the inning, and Hudson retired the final six batters he faced.

Blanco hit the first ball out of the infield by either team over the wall in center for a leadoff homer in the third inning. Hudson followed with his fourth career homer - first since April 30, 2013 - on a towering shot to left. At 40, he is the oldest Giants pitcher to hit a home run since Steve Carlton on July 21, 1986, at 41 years old.

It was the first time San Francisco hit back-to-back homers involving a pitcher since May 25, 1979, when left-hander Bob Knepper and Mike Sadek connected against Phil Niekro. Giants pitchers have seven homers this season, their most since 1955.

A run-scoring double by Panik and Matt Duffy's RBI single were enough for Diamondbacks manager Chip Hale, who immediately called to the bullpen instead of going out to talk to Anderson. Brandon Belt added a run-scoring double to put the Giants up 5-0.

Anderson allowed five runs and five hits in two-plus innings.

TRAINER'S ROOM

Giants: SS Brandon Crawford left after the sixth inning with tightness in his left calf and left side.

Diamondbacks: Arizona recalled RHP Evan Marshall from Triple-A Reno and placed him on the 60-day DL. He has been out since undergoing surgery to relieve brain swelling after being hit in the head by a line drive on Aug. 4 while pitching for the Aces.

UP NEXT

Giants: RHP Chris Heston is 0-4 with a 5.28 ERA his last six starts heading into Wednesday's game against Arizona.

Diamondbacks: RHP Zack Godley will make his first career start against the Giants on Wednesday. The rookie is 4-1 with a 3.62 ERA in six games this season.