SAN DIEGO (AP) -- Didi Gregorius and the Arizona Diamondbacks have plenty of experience by now in winning extra-inning games.
Gregorius tripled home the tiebreaking run in the 12th inning to lift the Diamondbacks over the San Diego Padres 2-1 on Tuesday night.
Arizona set a major league record for most extra innings played in a season with 79. The Diamondbacks, who are 17-7 in extra-inning games, broke the record of 76 set by the 1969 Minnesota Twins.
''A lot of the games we played extra innings were because of blown saves,'' reliever Brad Ziegler said. ''But it also says a lot about our offense because there were a lot of games that we came from behind to get to extra innings, too. We've won a whole lot of those games. It's hard on the pitching staff and it's fatiguing for everybody, but we fought through and played those games well.''
Paul Goldschmidt hit his NL-best 36th homer for the Diamondbacks, extending his hitting streak to 14 games and increasing his league-leading RBI total to 124.
It appeared his solo shot in the sixth might hold up, but the Diamondbacks were destined for another extra-inning game. Arizona took a four-hitter into the eighth before San Diego tied it on a passed ball.
''We have been resilient in these games all year,'' Diamondbacks manager Kirk Gibson said. ''You have to go through it and we hung in there. It feels good to get this win.''
Gregorius tripled down the right-field line against Luke Gregerson (6-8) to score fellow rookie Chris Owings, who doubled with one out.
''Luke just hung a breaking ball to Owings and the ball was up to Gregorius that he put enough bat on the ball and hit it hard,'' San Diego manager Bud Black said.
Josh Collmenter (5-4) pitched a perfect inning and Ziegler got three outs for his 12th save.
Diamondbacks reliever David Hernandez gave up consecutive singles to pinch-hitter Mark Kotsay and Chris Denorfia to open the eighth inning. The right-hander then struck out Jesus Guzman, retired Jedd Gyorko on a grounder and intentionally walked Chase Headley to load the bases.
With rookie Tommy Medica batting, catcher Miguel Montero allowed a passed ball on Hernandez's off-speed pitch that let pinch-runner Reymond Fuentes score the tying run.
Arizona starter Wade Miley allowed just four singles, including two infield hits, in six innings. Miley, making his career-high 32nd start, struck out seven, walked one and let just one runner reach third base.
Miley lost all four of his previous starts against San Diego this season.
Tyson Ross kept San Diego in the game with eight strong innings, allowing one run and three hits. Ross struck out six, walked two, hit a batter and threw a wild pitch.
Goldschmidt's homer to right-center barely cleared the top of the wall.
''I wanted it off the plate, but it caught too much,'' Ross said. ''He's one of the best hitters in the National League and he put a good swing on it.''
NOTES: During his hitting streak, Goldschmidt has six doubles, five homers and 17 RBIs. ... Padres SS Ronny Cedeno wasn't in the lineup after being hit in the head by a pitch from reliever Heath Bell on Monday night. ''He's not doing great,'' Black said. ''The doctors said (Monday) night he was concussed to a certain point.'' ... Padres OF Will Venable (abdominal strain) missed his second straight game. ... Diamondbacks RHP Randall Delgado (5-6, 3.96 ERA) faces Padres RHP Ian Kennedy (6-10, 5.06) on Wednesday night.