Updated

SAN DIEGO (AP) 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.