CLEVELAND (AP) -- For eight innings, the Tigers couldn't connect in the clutch. They were exasperated, annoyed and seemingly on their way to a tough loss.
One swing by J.D. Martinez changed their mood.
Martinez hit a three-run homer off closer Cody Allen with one out in the ninth inning, rallying the Tigers to a 4-2 win over the Cleveland Indians on Tuesday night.
''He hit it so hard, it sounded like thunder,'' teammate Torii Hunter said.
Martinez's shot into the shrubs beyond the center-field wall bailed out the Tigers, who stranded 12 runners through eight. But in the ninth, Hunter drew a leadoff walk from Allen (5-4), Miguel Cabrera singled, and after Victor Martinez flied out, J.D. Martinez ripped his 19th homer, a crushing blow to the Indians.
''It was one of those swings where you hit it and it just feels perfect,'' Martinez said, ''like you couldn't do anything else or any better. When I reached home, I was like, 'Did I touch every bag?' You get caught up in the situation. It's September, this is the month you win or go home.''
Phil Coke (3-2) pitched 1 1-3 innings and Joe Nathan worked the ninth for his 29th save.
Detroit's comeback kept the Tigers on the heels of first-place Kansas City in the AL Central. The Royals have a half-game lead in the division.
The Indians wasted a strong performance by Carlos Carrasco, who side-stepped danger for 5 1-3 innings and struck out a career-high 10.
Carlos Santana hit a two-run homer for Cleveland, which has dropped the first two in this critical four-game series and fell 5 1/2 games out of first.
J.D. Martinez has hit two homers in three career at-bats off Allen, who was trying to protect a 2-1 lead against the middle of Detroit's vaunted lineup.
''I was just overthrowing it,'' Allen said. ''I just didn't make pitches when I had to. One pitch - J.D. Martinez got extended on a fastball and hit it very hard.''
Until Detroit's uprising, Carrasco was in line for his fourth straight win. The right-hander managed to work out of jams in four straight innings, making big pitches and keeping the Tigers' power hitters in the ballpark one night after Detroit slugged five homers and collected 20 hits.
Tigers rookie starter Kyle Lobstein was superb in his first career road start, allowing five hits in 5 1-3 innings and striking out 10.
Every time the Tigers threatened, Carrasco found a way out of trouble.
Clinging to a one-run lead in the fifth, he gave up a leadoff double to Cabrera, who went to third on Victor Martinez's single. Carrasco then struck out J.D. Martinez looking, fanned Nick Castellanos and locked up catcher Alex Avila with an 84 mph off-speed pitch to end the inning, celebrating his 10th whiff with a demonstrative fist pump.
Even Cabrera patted Carrasco on the rear as the right-hander passed him while leaving the field.
''He really dug deep,'' Indians manager Terry Francona said of Carrasco. ''That was really something. He pitched out of so many binds and executed some unbelievable pitches.''
Santana got the Indians out of the gate fast, hitting his 23rd homer in the first. Michael Brantley singled with two outs before Santana connected for a shot into Detroit's bullpen in right.
Avila was removed in the sixth after taking a foul ball of his mask. He felt dizzy and struggled to answer the trainer's questions. He was feeling better after the game, but will have further tests Wednesday. The veteran catcher missed two weeks last season with delayed concussive symptoms.
HOT IN CLEVELAND
Even before his homer, J.D. Martinez liked Progressive Field. He's batting .464 (13 of 28) with five homers, 13 RBIs and six runs in seven games at the ballpark this season.
Tigers: RHP Joakim Soria (strained left oblique) played catch from 140 feet before the game. Soria, acquired at the trade deadline from Texas to shore up Detroit's shaky bullpen, has been on the disabled list since Aug. 10. Tigers manager Brad Ausmus said Soria was pain-free for the first time, and will likely throw batting practice instead of pitching in the minors.
Detroit RHP Justin Verlander (12-11) hasn't pitched like himself most of this season. He's dealt with shoulder issues and the 2011 AL MVP hasn't been nearly as dominant as in previous years. But it's September, there's important games ahead and he's still a handful for the Indians, who will counter with Danny Salazar (5-6).