DETROIT — On Saturday night, the Detroit Tigers didn't look like a team that was ready to break a season-long streak of futility.

The Tigers were 0-54 this year when trailing after eight innings and had lost six of seven games overall. But the Tigers overcame a five-run deficit to beat the Minnesota Twins 12-11 on Justin Upton's two-run homer in the ninth inning.

"I'm pretty sure that no one in this clubhouse knew that we were 0-54," Upton said. "We know that, despite everything, we've fought to the end of every game. It didn't pay off the first 54 times, but it did tonight."

The Tigers blew their own five-run lead before coming back to end Minnesota's six-game winning streak.

"That's a game that has a huge range of emotions," Tigers manager Brad Ausmus said. "We're up big and blow it, get down big and come back to win it. That's probably the best-tasting win of the year."

The loss, combined with Kansas City's win, means the Twins lead the Royals and Tampa Bay Rays by a half-game in the wild-card race.

"It's an ugly, tough loss to take," Minnesota manager Paul Molitor said. "We need to win games, but we had 11 runs and 19 hits and couldn't win."

After James McCann hit a grand slam in a five-run first inning against Jose Berrios, the Twins tied the score 5-5 in the third, then scored twice in the fourth, once in the fifth and three times in the sixth for an 11-6 lead.

Upton hit a sacrifice fly in the seventh, and McCann hit into a run-scoring forceout in the eighth and scored on Jose Iglesias' home run against Trevor Hildenberger that cut Detroit's gap to 11-10.

Shane Greene (3-2) escaped a bases-loaded jam when he struck out Miguel Sano on a slider. Mikie Mahtook singled against Belisle (0-2) starting the bottom half and Upton drove a high 2-1 fastball into the left-field seats.

"I was trying to stay patient, and he threw me a fastball up and over the middle," Upton said. "I knew it was gone off the bat."

Belisle, who took over as the closer when Brandon Kintzler was traded to Washington, was quick to blame himself for the defeat.

"A fastball teed up right down the middle is a tough pitch to get away with in the big leagues," he said. "I'll take full accountability for that and the loss tonight."

Tigers starter Jordan Zimmermann allowed seven runs and eight hits in 3 1/3 innings, while Berrios gave up six runs and six hits in 3 1/3 innings.

Joe Mauer's three-run double and Eddie Rosario's two-run homer, a 445-foot drive over the out-of-town scoreboard in right-centerfield, tied the score for the Twins in the third.

"Even at 5-0 down, we thought we still had a chance," Mauer said. "It was just a crazy game."

Minnesota's Byron Buxton homered leading off the fourth, sprinting around the bases at top speed until third-base coach Gene Glynn informed him the ball was in the seats.

TRAINER'S ROOM

Twins: LHPs Hector Santiago (back) and Glen Perkins (shoulder) are both continuing minor-league rehab assignments and could return to the Minnesota roster next week.

Tigers: 1B Miguel Cabrera left with lower-back tightness after six innings.

"It is a little bit of a concern, because it is on the other side from what was bothering him before," Ausmus said. "I'll check with him in the morning, and we'll go from there."

CASTELLANOS CHANGING POSITIONS

Ausmus said 3B Nick Castellanos will begin working out in right field and could play there by the end of the season. Castellanos has struggled badly at third base, and the Tigers recently acquired highly regarded third-base prospect Jeimer Candelario in a trade with the Chicago Cubs. Castellanos played nine games in left field in 2003 but has been exclusively at third since.

"I don't know how it will work out, but I brought it up to them," Castellanos said. "If it is beneficial to the team, I'm all for it."

UP NEXT

RHP Ervin Santana (12-7) is to start Sunday's series finale for the Twins. Santana is 9-5 with a 3.36 ERA in 20 starts against Detroit, but gave up five runs in 3 1/3 innings on July 21. LHP Matt Boyd (5-6) opens for the Tigers. He is 5-1 with a 3.52 ERA against the Twins, the only major-league team he has beaten more than twice.

___

More AP baseball: https://apnews.com/tag/MLBbaseball