DETROIT – The number has signified misery for the Twins ever since the 2016 season ended. Fifty-nine wins? In a 162-game season? It was an embarrassing flop for a team that believed its fortunes were turning around.

But 59 wins means something completely different for the Twins today, after they arrived at that total Sunday with an eighth-inning rally that delivered a 6-4 victory over the Tigers at Comerica Park, site of so many humbling losses over the past few seasons. At 59-57, their best record at this point of the season in seven years, 59 means hope, it means progress, and by bouncing back from a crushing loss the night before, it might mean resilience, too.

Because this was a torturous nine innings.

"It felt like a struggle," Twins manager Paul Molitor said after his team blew an early lead, in one of the ugliest innings of the season, for the second consecutive game — then bounced back to win a series from the Tigers for the first time in seven tries. "I'm familiar with that number. It's amazing the difference a year makes — we're still looking at 46 games to go. We all know what happened last year, having to endure that. We're in much better position now."

No kidding. A team that bottomed out 35½ games out of first place last season sits only a half-game behind the Angels for a wild-card birth, and just 4½ games behind Cleveland in the AL Central. And by coincidence, the Indians visit Target Field starting Tuesday, for games that have suddenly acquired meaning.

Those three games won't be easy, but the Tigers never are, either, and the Twins withstood any lingering doubts born of their shocking collapse a night earlier.

"Everybody regrouped and got the job done," said Ervin Santana, whose day was undone by a bizarre fifth inning. "It shows we still believe in ourselves. We still believe in our offense and defense."

What are the Twins' playoff chances? Click here for the odds

Brian Dozier crushed his sixth leadoff homer of the year, Miguel Sano smacked his first home run since injuring his hand, and Byron Buxton pulled off the Twins' first squeeze play since 2015, helping the Twins build a 4-0 lead that some shaky defense and wobbly pitching gave right back. But with the score tied in the eighth inning, Buxton delivered again, lining a single over a drawn-in infield to earn Minnesota its seventh win in the past eight games.

"I've been trying to put it on the ground more, but in that situation, I have to try to drive it to the outfield," said Buxton, 7-for-17 (.412) on this road trip. "The biggest thing for me was being comfortable and staying confident. All I had to do was get one run, and fortunately I got a good pitch."

Santana lasted five innings, but the final two were a mess. He allowed four hits in the fourth, yet gave up just one run thanks to back-to-back strikeouts. But then the fifth inning devolved into more giveaways than a clearance sale: Sano's foot lost touch with the first-base bag as he fielded a throw from Jorge Polanco, an error that hinted at the ugliness to come. After former Twin Alex Presley doubled and Nick Castellanos singled, Santana and catcher Chris Gimenez embarked on a carnival of wild throws and bungled catches.

"That was the inning from hell," said Gimenez, who allowed three pitches to glance off his glove during the inning, a trio of passed balls (oh, and there was a wild pitch, too) that kept Tigers baserunners moving, two of them crossing home plate. "It's my fault. I'm a big-league catcher. I should be able to catch anything, no matter what the situation is."

But the Twins shook off the shock. After Tigers reliever Bruce Rondon opened the eighth inning with nine pitches, eight of them balls that increasingly energized a booing crowd, the Twins turned that two-walk opening into a game-winning rally. Polanco sacrificed the runners up a base, and Buxton swatted a single to center to break the tie. Ehire Adrianza followed with a sacrifice fly, and the Twins had a lead that Tyler Duffey and rookie Trevor Hildenberger — the latter earning his first major league save — made hold up.

"That was a big gut-check," Hildenberger said. "The way we've been going, and the role the bullpen played last night, it hurt. A lot. And then to come out today and win was huge: Win the series, finish a great road trip and go into the series with the Indians on all cylinders."