SAN DIEGO -- Shortstop Erick Aybar, who was hitless in his previous 16 at-bats, homered off Zack Greinke with one out in the eighth inning Wednesday night to give the San Diego Padres a 1-0 victory over the Arizona Diamondbacks at Petco Park.

Aybar pulled a full-count slider from Greinke 361 feet into the right field seats to break up a classic pitching duel between right-handers Greinke (1-2) and the Padres' Jhoulys Chacin.

Chacin (2-2) allowed three hits and a walk with five strikeouts in eight innings. Arizona had one runner in each of the first four innings before Chacin closed out his night by retiring the final 14 Diamondbacks he faced. No Diamondback reached second against Chacin, who retired eight Diamondbacks on ground balls.

Padres catcher Austin Hedges threw out Brandon Drury trying to steal second after leading off the second inning with a single.

Chacin has pitched 14 2/3 innings at Petco Park this season without allowing a run.

Right-hander Brandon Maurer followed Chacin and picked up his seventh save despite allowing a lead-off single. Maurer struck out Diamondbacks cleanup hitter Jake Lamb on a full-count changeup to end the game with the tying run at third.

Greinke had allowed only two hits and a walk with a fourth Padre reaching base on an error through the first 7 1/3 innings before Aybar came to the plate with a .128 average.

The win snapped a five-game losing streak for the Padres. Arizona had won three straight.

NOTES: The Padres placed RHP Jarred Cosart on the 10-day disabled list Wednesday with a right hamstring strain suffered during Tuesday night's start. ... RHP Luis Perdomo (right posterior shoulder inflammation) is expected to come off the disabled Sunday and start in Cosart's scheduled spot. ... RHP Kevin Quackenbush was promoted from Triple-A El Paso to immediately take Cosart's roster spot. ... Arizona 3B Jake Lamb equaled his career best by reaching base in a 14th straight game with a fourth-inning single. ... Padres 1B Wil Myers extended his hitting streak to 10 straight games with a single in the fourth.