PHOENIX -- Chase Anderson gave up a homer, then another. Three more hits in a row, his night was done.

He barely knew what hit him.

Anderson gave up a pair of homers and was lifted without getting an out in the third inning, setting the stage for the Arizona Diamondbacks' 6-2 loss to the San Francisco Giants on Tuesday night.

More from FoxSports

"I look back and it kind of happened really fast," Anderson said. "I left the ball up with some pitches, didn't hit spots."

Tim Hudson did.

He was called on to start on short notice after Ryan Vogelsong pitched in relief the night before. The right-hander had yet to be stretched out since coming off the disabled list on Sept. 1, pitching no more than two innings.

Hudson (7-8) had no trouble with the extra work, spotting his pitches well while allowing a run and four hits in his first start since July 26.

In case that wasn't enough, he hit a solo homer in San Francisco's five-run third inning off Anderson (6-6) and later added a single. The homer had the Giants laughing in the dugout after watching a 40-year-old who hadn't taken batting practice in two months launch one over the wall in left.

"To hit a home run, a 40-year-old man, that's quite a game," said Giants manager Bruce Bochy, who added Hudson will rejoin the rotation. "He's had a lot of wins and a lot of great games. To go out there and perform like that and have that kind of night with the bat is really impressive."

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.

San Francisco's bullpen held up after Hudson left, holding the Diamondbacks to one hit -- Jarrod Saltalamacchia's solo homer in the seventh -- over the final five innings.

"He was good tonight," Diamondbacks manager Chip Hale said of Hudson. "He did a good job."

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 before getting the call Tuesday.

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, his 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.

"BP's really overrated," Hudson joked. "All it does is mess my swing up. But it feels good. It really does."

Panik followed with a run-scoring single and Matt Duffy had an RBI single, which were enough for Hale. He 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.

"It is amazing for two innings we thought he had really good stuff and then just location started to get bad," Hale said.

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.