PHOENIX — Outfielder J.D. Martinez has been a key cog in Arizona's success since arriving July 18, so perhaps it was fitting that his walk-off single on Sunday guaranteed the Diamondbacks a home wild-card game.
Martinez's two-out single that one-hopped the left-field fence in the ninth inning broke a 2-2 tie and gave the Diamondbacks a 3-2 victory over the Miami Marlins at Chase Field, clinching home-field advantage in the one-game wild-card playoff Oct. 4.
"This is just the beginning," Martinez said. "This isn't it. It gets better. Every one gets bigger. Every one gets more celebration, more bottles. From the day I got here, they've been talking about making the playoffs and doing something that hasn't been done in a while."
Martinez has 27 homers and 58 RBIs since being acquired from Detroit, and that includes the 18th four-homer game in major league history.
"They've embraced me from the moment I came in," Martinez said. "It feels like home already. I said it from the moment I came here, I am just trying to jump on your guys' train."
The Diamondbacks (90-66) clinched the top wild-card berth earlier, at 2:04 p.m. Mountain time, when Milwaukee lost to the Cubs. St. Louis had lost earlier.
Arizona will make its first appearance in a wild-card game and its sixth playoff appearance. Arizona won the NL West in 1999, 2001, 2002, 2007 and 2011 and won the World Series in 2001.
"We are the best effing team," manager Torey Lovullo told his team as they gathered during the postgame celebration.
The team erupted with cheers and a chants of "Torey, Torey."
Chris Herrmann walked to open the ninth inning off Justin Nicolino (2-3) and pinch-hitter Kris Negron reached on a sacrifice bunt as Herrmann took third on Nicolino's throwing error to first. David Peralta was intentionally walked.
The Marlins got two forceouts at the plate before Martinez came to the plate.
Fernando Rodney (5-4) struck out two in a 1-2-3 ninth inning for the victory.
Arizona tied the game in the eighth inning when Paul Goldschmidt singled, took second on left fielder Marcel Ozuna's fielding error and scored on Daniel Descalso's one-out single to tie the game at 2.
"We will enjoy this, then get back to work," Goldschmidt said.
With six games to play, Arizona has made a 21-game improvement from 2016. General manager Mike Hazen and Lovullo were hired after a 69-93 season.
"It's a credit to what everyone bought into, from the manager's message on Day 1," Hazen said.
"Torey's done a great job with his staff over there," Miami manager Don Mattingly said. "They play good baseball, they're a tough club."
Arizona left-hander Patrick Corbin gave up five hits and two runs in 6 2/3 innings. He struck out five and walked four, one intentionally.
Miami right-hander Dan Straily gave up four hits and one run in six innings. He struck out nine and walked three.
Straily doubled with one out in the third inning and scored on Giancarlo Stanton's two-out single to make it 1-0. Stanton was thrown out by center fielder A.J. Pollock while attempting to stretch it to a double.
Stanton had six RBIs in the three-game series and has 126 this season, extending his franchise record. Preston Wilson had the previous record, 121, in 2000.
Marlins third baseman Brian Anderson hit a two-out double after two Corbin walks for a 2-0 lead in the fourth inning.
Herrmann hit his 10th homer of the season to break up Straily's shutout in the fifth inning. He is the 10th Diamondbacks player with double-digit homers this season.