SAN DIEGO — Paul Goldschmidt homered twice, including a go-ahead, two-run shot in the sixth inning, and Zack Greinke pitched six strong innings to lead the Arizona Diamondbacks to a 3-2 victory over the San Diego Padres on Wednesday night and avoid a three-game sweep.

The Diamondbacks pulled into a tie with the Padres for fourth place in the NL West at 64-88.

Goldschmidt’s 22nd and 23rd homers provided all of Arizona’s runs and came off rookie Luis Perdomo (8-10). Goldschmidt hit a solo shot into the seats in left field with two outs in the first for a 1-0 lead, and a go-ahead, two-run homer into the Padres’ bullpen in left-center with two outs in the sixth.

Greinke (13-7) held San Diego to two runs and six hits while striking out seven and walking four. He improved to 8-1 lifetime against the Padres.

His only big mistake was allowing Wil Myers’ two-run homer to left-center with two outs in the third for a 2-1 lead, his 27th. Jon Jay was aboard on a walk.

Daniel Hudson earned a four-out save, his fourth.

Perdomo allowed three runs and five hits in seven innings, struck out two and walked none.

Before the game, the Padres called up four of their top prospects. Two made their major league debuts as pinch-hitters in the seventh. Carlos Asuaje was punched out by Randall Delgado and Hunter Renfroe was intentionally walked by Edwin Escobar. A third, Manuel Margot, made his big league debut as a pinch-runner in the eighth.

UP NEXT:

Diamondbacks: Arizona is off Thursday and opens a three-game series at Baltimore on Friday, with RHP Shelby Miller (2-12, 6.90) scheduled to oppose Yovani Gallardo (5-8, 5.77).

Padres: LHP Christian Friedrich (5-10, 4.78) is scheduled to start for the Padres in the opener of a four-game series against the San Francisco Giants, who are trying to stay alive in the wild card race. The Giants are scheduled to counter with Jeff Samardzija (11-10, 3.97)