PHOENIX (AP) -- The Arizona Diamondbacks came from six runs down to force extra innings. In the end, they just couldn't overcome their mistakes.
Arizona lost 7-6 to the Chicago Cubs when reliever David Hernandez gave up a two-out walk and a run-scoring double in the top of the 12th inning Wednesday night.
Hurt by leaving 16 men on base, the Diamondbacks fell 1 1/2 games behind the Los Angeles Dodgers for first place in the NL West.
"We fought back and made a lot of mistakes and they caught up to us," Diamondbacks manager Kirk Gibson said. "We left a zillion guys on and not really swinging at good pitches in those situations. ... We have no one to blame but ourselves."
The Cubs' Nate Schierholtz lined a two-out double into the left-field corner to drive in the go-ahead run. He also saved a potential run with a throw from right field in the ninth inning that ultimately held Arizona to a tie and helped send the game into extra innings.
Schierholtz also hit a three-run home run as part of his career-high five-RBI night.
"It's good to win after they came back like that," Schierholtz said. The Cubs are 5-2 on the road in extra-inning games this season.
Hector Rondon (2-0) pitched the 11th and 12th innings for the win. Hernandez (4-6) took the loss after Arizona's relievers had pitched 6 2-3 scoreless innings.
"I still had plenty of opportunities to make pitches," Hernandez said. "Eventually I have to start doing my job because it's not fair to my teammates who worked so hard. Every mistake I make gets hit."
Diamondbacks slugger Paul Goldschmidt hit his 22nd home run, a three-run shot in the sixth inning.
Cubs starter Jeff Samardzija wasn't always sharp, but he managed to get through 5 2-3 innings, allowing three earned runs on six hits with five walks and five strikeouts before exiting.
Samardzija ran into trouble in the first inning, loading the bases with two out on two walks and a hit. But he struck out Jason Kubel looking to end the threat.
The Cubs took the lead in the fourth inning on David DeJesus' leadoff double to deep center field, followed by a sacrifice and Rizzo's RBI double. Rizzo came home to score on a single by Schierholtz.
DeJesus was in the lineup for his first game since going on the 15-day disabled list with a right shoulder sprain on June 15.
After Samardzija got out of another two-out, bases-loaded jam in the bottom of the fourth, the Cubs did their damage in the fifth. With two out, DeJesus singled and scored on Junior Lake's double. Rizzo walked, then Schierholtz pulled his home run down the right field line.
That gave the Cubs a 6-0 lead, with all runs coming off Diamondbacks starter Ian Kennedy. The right-hander has struggled in his last three starts at home. Wednesday he lasted five innings, giving up six runs on seven hits while striking out seven.
Lake doubled in the first inning and added his RBI double in the fifth, raising his hit total to 14 in his first six games in the majors.
The Diamondbacks got on the board in the fifth when Samardzija again loaded the bases, this time with none out. With one out, Martin Prado hit a sharp ground ball up the middle that Chicago second baseman Darwin Barney let go under his glove for an error. Two runs scored, but Samardzija avoided further damage.
"The Diamondbacks do that to me every time. They have a great approach at the plate and they have a plan against me," Samardzija said. "It was a good battle out there. You just can't walk guys, it brings up your pitch count."
Arizona chased Samardzija in the sixth by putting runners at first and third with two out. Goldschmidt greeted reliever Blake Parker with a line drive home run to left field, plating three runs to make it 6-5.
The Diamondbacks put runners on the corners with no outs in the ninth against Cubs closer Kevin Gregg. After a flyout, pinch hitter Cody Ross hit a sacrifice fly deep enough to allow Goldschmidt to score the tying run.
Gregg escaped a bases-loaded jam in the 10th, getting Prado to ground out to end the inning.
NOTES: Diamondbacks C Miguel Montero sat out a second straight game due to back pain. He felt it during batting practice before Tuesday's game and was to see a doctor Wednesday. ... Diamondbacks 3B Eric Chavez has 28 RBIs in his last 31 starts after going his first five starts without driving in a run, according to the Elias Sports Bureau. ... In activating DeJesus, the Cubs optioned OF Dave Sappelt to Triple-A Iowa. DeJesus most recently played three games with Mesa of the rookie league, where he went 4 for 11 with four runs scored, two doubles and a walk. ... Samardzija and second baseman Barney collided when going for a slow roller to second off the bat of Arizona's Wil Nieves in the fourth inning. Neither was hurt.
© 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.