PHOENIX -- Paul Goldschmidt hit a walkoff home run off the batter's eye in dead center field to help the Diamondbacks break a four-game losing streak for a 3-2 victory over Miami on Tuesday.
Goldschmidt hit the second pitch he saw from Chad Qualls for his 17th homer of the season, his second walkoff hit after beating the Los Angeles Dodgers with a single on April 14.
Goldschmidt has 62 RBIs, second in the majors to Detroit's Miguel Cabrera, and has homers in the first two games of the series.
The D-backs (38-33) maintained their thin lead in the NL West with only their second victory since the brawl-marred game against the Dodgers a week ago.
Miami (22-48) had won three of its last four and six of its last nine.
David Hernandez (3-1) pitched a 1-2-3 ninth inning for the victory.
Arizona third baseman Martin Prado hit his fifth home run of the season, his first since April 29.
The Marlins did not have a hit after rookie shortstop Adeiny Hechavarria doubled into the left-field corner to open the seventh inning but was thrown out by Jason Kubel attempting to stretch it into a triple. Kubel has four assists this season after leading NL outfielders with 14 last year.
A.J. Pollock was doubled with two outs in the last of the seventh but did not score. Pollock leads major league rookies with 19 doubles.
Miami struck first in a matchup of right-handers making their first starts of the season, the Marlins' Nathan Eovaldi and Arizona's Randall Delgado.
Logan Morrison singled with one out in the fourth inning before Derek Dietrich tripled to right-center to make it 1-0. Hechavarria singled to right field to make it 2-0. Dietrich, who made his major-league debut May 8, has reached safely in 30 of his 34 games.
Prado's two-run home run with two outs in the last of the fourth tied the game at 2-2.
Miami left fielder Juan Pierre extended his hitting streak to 14 games with a single in the third inning. He has 10 hitting streaks of at least 14 games, tied for third among active players with Michael Young behind Ichiro Suzuki (19) and Derek Jeter (17).
NOTES: The Diamondbacks signed first-round draft choice RHP Braden Shipley to a $2.25 million bonus Tuesday, and he is to report to Class A Hillsboro. Shipley, the 15th player taken in the draft, was 7-3 with a 2.77 ERA at the University of Nevada this season. ... With two home runs Monday, Giancarlo Stanton joined Bob Horner and Eddie Mathews as the only players to start their major-league career before their 21st birthday and have 100 homers in their first 400 games, according to Elias. Stanton hit both levels Monday, and is the ninth fastest to 100 homers in major-league history by games played. Ryan Howard did it the quickest, in 325 games. ... The Marlins optioned LHP Edgar Olmos to Double-A Jacksonville to make room for Eovaldi. ... The D-backs optioned RHP Charles Brewer to Triple-A Reno to make room for Delgado, who could be in line for more starts with RHP Ian Kennedy serving his 10-game suspension and RHP Brandon McCarthy (shoulder) on the disabled list.