The Tampa Bay batters struggled, James Shields allowed double-digits hits, and the result was the Rays losing their fourth in a row.

Max Scherzer struck out seven in six innings and Miguel Cabrera had four hits and drove in two runs to lead the Detroit Tigers to a 5-2 victory over the Rays on Thursday night.

Detroit has won 10 of 12 against the Rays, compiling a 2.22 ERA over the stretch dating to August 2010.

"We do not hit well against this team," Tampa Bay manager Joe Maddon said. "We just have a hard time scoring against them. They've gotten us pretty good."

The Rays have lost seven of nine overall and are 5-11 since June 11, when they most recently led the AL East.

"We just need to be more consistent offensively," Maddon said. "Normally we feed off of our defense. I think we need to start feeding off our offense a little bit."

Scherzer (7-5) allowed two runs and four hits in his second start following the death of his brother earlier this month. The right-hander was replaced after walking the only batter he faced in the seventh inning.

"As difficult as the time is for me, it's about going out there and pitching well and helping the team," Scherzer said. "That's what that one goal is, we want to win. Anytime I can go out there and give our team a chance to win, that's what I'm all about."

Cabrera hit a solo homer in the ninth and had two singles and a double to continue a stretch in which he's hit .342 over the past 46 games. His sixth-inning RBI single off Shields (7-5) gave Scherzer a 4-1 lead.

Delmon Young, Alex Avila and Quintin Berry also drove in runs off Shields, who allowed four runs and a career-high 14 hits in 7 2-3 innings. Austin Jackson had four hits off the Rays starter, helping Detroit end a two-game losing streak.

"It wasn't a very good day," Shields said. "You can compete all you want, and you can go deep into the game all you want, but the bottom line is you lost the game. I've got to do a better job."

Scherzer, who has won six of his past eight decisions, gave up a RBI single to Elliot Johnson in the fifth inning. He walked Jeff Keppinger leading off the seventh, and Tampa Bay scored its second run when Brooks Conrad doubled off reliever Phil Coke and Berry mishandled the hit into the left field corner for an error.

Scherzer left the Tigers this month following the death of his brother. He returned two days later and allowed three runs and three hits over six innings of a 4-1 loss to Pittsburgh on June 23.

Young, Avila and Berry staked Scherzer to an early three-run lead that could have been much larger.

The Tigers had a runner thrown out at the plate in the fourth and stranded eight while scattering 11 hits off Shields through the first five innings.

Scherzer didn't allow a runner past first base until Conrad doubled off the right-field wall and scored on Johnson's one-out single in the fifth for Tampa Bay.

Coke and Joaquin Benoit got the Tigers through the seventh and eighth innings. Jose Valverde pitched the ninth to earn his 14th save in 17 opportunities.

NOTES: Tampa Bay has allowed 10 or more hits in three of its last four games. ... Rays 3B Evan Longoria, out since May 1, hasn't resumed baseball activities since feeling discomfort in his injured left hamstring during a minor league rehab assignment that was cut short on June 18. ... Tampa Bay activated DH Luke Scott (back stiffness) from the 15-day disabled list and optioned RHP Chris Archer to Triple-A Durham. RHPs Jeremy Hellickson (right shoulder inflammation) and Kyle Farnsworth (right elbow strain) are expected to return from the DL on Saturday.