The Rays had lost five of their past six games as the Red Sox padded their lead in the American League East. Boston’s lead now stands at 8 1/2 games, and Tampa Bay moved within two games of the Texas Rangers for the first AL wild-card spot.

After losing what Tampa Bay manager Joe Maddon referred to as the “battle of inches” the past two nights, the game swung in the Rays’ favor with two outs in the eighth inning and Evan Longoria on second base.

Rookie Wil Myers hit a fly ball that dropped just inside the foul line in right field. A few inches to the right and it would have fallen foul. A little farther to the left and it might have been caught. Instead, it found fair territory and brought home the tiebreaking run.

The Rays missed an opportunity to pad their lead in the fifth and it came back to haunt them as the Red Sox erased a two-run deficit in the sixth with an opposite-field home run by David Ortiz and Stephen Drew’s tying RBI double.

The Rays came to life in the second inning against Red Sox starter Jake Peavy. Longoria drilled a leadoff triple to right field and scored on Myers’ single up the middle, giving the Rays their first lead of the series.

Tampa Bay made it 2-0 in the third when David DeJesus walked and scored on James Loney’s double off the right-field wall.

Jarrod Saltalamacchia pulled the Red Sox within one run in the fourth, snapping his 0-for-21 skid with a solo homer to right field. But Desmond Jennings answered for the Rays in the bottom of the fourth with a solo shot to left, matching a career high with his 13th homer this season.

NOTES: Rays C Jose Molina was not with the team as he traveled to St. Louis to be with his mother, Gladys, who was recovering from a surgical procedure. Molina is expected to rejoin the Rays on Friday in Minnesota.