BOSTON -- Tampa Bay's Francisco Mejia singled with the bases loaded in the ninth, Boston's Hunter Renfroe made a costly error on the play, and it helped the Rays rally past the Red Sox 8-4 on Tuesday night.
Tampa Bay's lead in the American League East is now up to five games.
The Rays were 2-of-9 with runners in scoring position before Mejia, who entered the game as a defensive substitution in the seventh, delivered a single to right. The ball skipped past Renfroe for an error, and that allowed all three runners to score, giving Tampa Bay a 7-4 lead.
"He was ready for it and just laced a big double -- whatever it was -- right down the line for just huge runs for us," manager Kevin Cash said.
Officially, Mejia was credited with a single and two RBIs, and the Rays added another run on Brandon Lowe's single. Louis Head shut down Boston in order in the ninth to finish off the Red Sox, who lost for the 10th time in 12 games.
Lowe also homered for the Rays, who got a two-run double from pinch hitter Ji-Man Choi to tie it at 4-all in the seventh after Boston had led 4-1.
"For Ji to come off the bench like that and put together the at-bat that he does, it's very impressive and a huge testament to him," Lowe said.
Andrew Kittredge (8-1) pitched two scoreless innings of relief for Tampa Bay.
The Red Sox blew a game they desperately needed, coming off a 2-8 road trip that started with a three-game sweep by the Rays in Tampa Bay. Matt Barnes (6-5) pitched the ninth for Boston and took his second straight loss.
"We didn't make pitches with two strikes and they got to Barnesy at the end," Boston manager Alex Cora said. "It's been a grind for him lately and it was a grind for us tonight."
Renfroe hit a three-run homer for Boston in the fourth and Rafael Devers led off the second with his 28th homer of the year.
Eduardo Rodriguez gave Boston a solid start, striking out eight over 5⅓ innings. He allowed two runs on four hits and a walk, getting pulled in the sixth after Wander Franco's RBI single scored Mike Zunino to pull the Rays within 4-2.
The only other run allowed by Rodriguez was Lowe's 25th homer in the third.
Luis Patino pitched six innings for the Rays, allowing four runs on six hits and three walks. He struck out seven.