DETROIT (AP) -- Rajai Davis was worried that his day might be over soon after it began.
In the bottom of the first inning, the Detroit leadoff man thought he had sustained some kind of freak injury and signaled to the training staff for attention.
"I took an awkward swing, and it felt like my bones were rubbing against each other," he said. "It was inside of me, internally. It didn't feel too pleasant, but it went away. I'm trying to figure it out myself."
Davis stayed in after a few test swings and obviously wasn't seriously injured as he hit two homers for just the second time in his career, sending the Tigers over the Tampa Bay Rays 5-4.
Davis hit a two-run shot in the third, then broke a 4-all tie with a solo drive in the seventh. His other two-homer game came on May 18, 2012, for Toronto.
"I knew it was quite a while ago," he said.
With the temperature rising through the low 90s as the game progressed on a humid day, there were five homers, all to left field.
James McCann homered for the Tigers, connecting off former college batterymate Drew Smyly. Detroit won for just the fourth time in 17 games.
"He caught me for two years in school, but we never talked about what we would do if we ever faced each other," Smyly said. "Maybe I should talk to him about that now."
Evan Longoria and J.P. Arencibia homered for the Rays, who have lost four of five while trying to stay in the AL wild-card race. In 11 of its last 12 losses, Tampa Bay has rallied to tie the game or taken the lead before falling behind again.
"This is a very young team and these are really tough losses for them," Tampa Bay manager Kevin Cash said. "In the long run, it is a great learning experience, because we've played so many close games that every pitch of every at-bat matters. You learn how to play hard every out."
Al Alburquerque (4-1) picked up the win and Bruce Rondon got two outs for his fourth save. Tampa Bay loaded the bases with a single and two walks in the ninth, and the final out needed a review to confirm that second baseman Ian Kinsler stayed on the bag for a game-ending force play.
"It was wild, because I was running out there to ask the umps to let us look at a replay, and the Tigers were all out there shaking hands," Cash said. "They decided to go ahead and look at it, and Kinsler had made a great play."
Brandon Gomes (2-5) took the loss.
Smyly, traded to Tampa Bay last season as part of the deal for David Price, went five innings in his return to Comerica Park. He gave up four runs on seven hits and a walk.
This was the first time McCann and Smyly had played in the same game since college. McCann was always a level or two behind Smyly in the minors, and made his big league debut a month after Smyly had been traded to Tampa Bay.
Last month, McCann went 1-3 against Houston's Dallas Keuchel, another teammate at Arkansas. He singled in the second off Smyly before homering in the fourth.
"It's funny being able to face Dallas and Drew up here," he said. "I don't think catching them in college gives either side an advantage, but it is a lot of fun and something we can talk about for years. I know Drew wasn't very happy about my single, so I didn't talk to him after the homer."
Tigers starter Randy Wolf allowed four runs on eight hits in 4 1-3 innings.
Arencibia homered off the brick wall behind the left-center field stands. The drive was estimated at 464 feet, which would tie the record by a visiting player at Comerica Park currently held by J.D. Martinez when he was with Houston in 2013.
Rays: Steven Souza Jr. (broken left hand) was expected to play OF for Triple-A Durham in its season finale Monday. After that, the Rays will make a further decision on his rehab.
Tigers: DH Victor Martinez missed the game with an illness. He has a career .357 average in 76 games against Tampa Bay.
The teams play the second of a three-game series Tuesday night with Matt Boyd (1-3, 6.97) facing Tampa Bay's Erasmo Ramirez (10-5, 3.84). Ramirez has a 5.87 ERA in his last three starts, while Boyd is at 9.69 in his last three.