When Arizona's Aaron Hill won it with an RBI single in the 14th inning, the Diamondbacks and Cleveland Indians had used their entire bullpens, mustered a series of comebacks, and left 31 runners on base.
Hill's hit scored Gerardo Parra from third to give the Diamondbacks a 9-8 victory.
At 5 hours, 32 minutes, it matched the longest game in Chase Field history. The other was a 10-9 Diamondbacks' win over St. Louis on April 3, 2013.
"It felt like seven (hours)," Arizona's Miguel Montero said. "The game was slow anyway. Through seven it was like a three-hour game already. We had to play the extra innings and that made it longer. If we have to play 10 hours just to get the win, we will take it."
Parra tied his career high with five hits in a game that saw Cleveland tie it with a run in the ninth, and both teams score two in the 11th.
Parra singled off Mark Lowe (0-1), the Indians' 10th pitcher. He stole second and advanced to third on a fly ball. Lowe said Hill hit a bad slider.
"Just left it up a little bit," Lowe said. "He took some bad swings on some sliders before that. I had a good one going tonight so I was going to go with it."
Carlos Santana's two-run homer put Cleveland up 8-6 in the 11th.
David Peralta homered in the bottom of the inning and Ender Inciarte's RBI single tied it.
Josh Collmenter (6-4), usually a starter and the ninth pitcher for Arizona, pitched a scoreless 14th.
In the 13th, Jason Kipnis hit one off the wall in center and tried to stretch a triple into an inside-the-park home run but was easily out on the perfect relay throw from shortstop Didi Gregorius to the catcher Montero.
"It was perfect," Montero said. "Ender made a good though to Didi and probably threw it like 100 miles per hour right on the chip. We were talking about who we were going to pitch. We had Didi out there. It was a pretty good relay. Everything was perfect."
Cleveland manager Terry Francona said it was the right thing to send Kipnis home.
"I thought it was good baserunning," he said. "I thought it was good coaching, Sarby (third base coach Mike Sarbaugh) to recognize it and Kip to give it a chance, and then an even better play (by Gregorius). That was a really good throw."
Addison Reed blew his third save in 20 tries when he walked two Cleveland batters in the ninth, then gave up an RBI single to Yan Gomes to tie it at 6-6.
Cleveland went ahead 8-6 in the 11th when Randall Delgado walked Michael Brantley and Santana homered down the right-field line.
But in the Arizona half of the inning, the rookie Peralta homered off Bryan Shaw. Gregorius walked and went to third on Tuffy Gosewich's pinch-hit single off John Axford. Inciarte followed with his RBI single and it was 8-8.
Axford, the closer until Cody Allen took the job earlier this season, blew his third save in 12 chances.
Arizona rallied from three runs down to take a 6-5 lead on Hill's RBI single in the sixth.
Inciarte had four hits, walked, drove in two and scored twice. Montero had two RBIs on a pair of opposite-field hits.
Cleveland threatened in the 12th when Lonnie Chisenhall led off with a double off Matt Stites. Ryan Raburn walked and the runners moved to third and second on David Murphy's sacrifice bunt. But Stites struck out Michael Bourn looking and Asdrubal Cabrera hit one back to the mound to end the threat.
Trailing 5-2 after three innings, the Diamondbacks got two in fourth, then one in the fifth to tie it at 5-5.
In the sixth, Parra got caught in a rundown but barely evaded the tag to get back to second, Hill singled to center off Vinnie Pestano to bring him home and put Arizona up 6-5.
When Joe Thatcher came on with the bases loaded and retired the side without a run in the fifth, it was the first time in the left-hander's career that he came into a bases-loaded, no-out situation and retired the side without allowing a run. ... In the finale of the brief series on Wednesday night, Cleveland sends RH Corey Kluber (6-5, 3.30 ERA) to the mound, while Arizona goes with RH Chase Anderson (5-2, 3.18). ... It was Hill's 10th career walk-off hit. ... Arizona left 19 on base, Cleveland 12.
Hill, D-backs Walk Off In 14th
Aaron Hill's RBI single in the 14th lifted the Diamondbacks to a 9-8 win over the Indians.