SAN FRANCISCO — Travis Jankowski had three hits, including his fourth home run, and the San Diego Padres beat the Giants 3-2 on Wednesday night.

Freddy Galvis added two hits, and Wil Myers had a sacrifice fly to help the Padres win their final road game of the season. San Diego finished 35-46 away from Petco Park and is 29-49 at home.

Miguel Diaz (1-0) pitched two scoreless innings for his second career win. Diaz was the third of seven pitchers used by manager Andy Green on a day the Padres started reliever Luis Perdomo.

Kirby Yates struck out pinch-hitter Evan Longoria with two runners on in the ninth for his 12th save.

Aramis Garcia hit his fourth home run for San Francisco. The Giants, who fired general manager Bobby Evans earlier in the week, have lost 18 of 23.

Jankowski reached on an infield single leading off the fifth and advanced to second when San Francisco starter Casey Kelly (0-3) tried swiping the ball to first baseman Chris Shaw. After Jankowski took third on a groundout, Kelly was called for a balk and the run scored.

Jankowski homered off Kelly in the seventh to make it 3-0. He also tripled in the ninth.

The Giants pulled within 3-2 on Garcia’s two-run homer in the seventh.

San Francisco had two runners on later the same inning, but Matt Strahm retired pinch-hitter Kelby Tomlinson on a groundout.

Trainer’s room

Padres: 1B Eric Hosmer was held out of the starting lineup. He grounded out as a pinch hitter in the ninth.

Giants: Longoria did not start and was still feeling soreness in his left knee a day after fouling a ball off it. Alen Hanson started in Longoria’s absence. Nick Hundley was also held out of the starting lineup, although manager Bruce Bochy said the veteran catcher was fine after getting hit in the back of the head by a follow-through swing.