Mookie Betts and Mitch Moreland hit back-to-back home runs to break an eighth-inning tie as the Boston Red Sox beat the Tampa Bay Rays 6-4 on Friday at St. Petersburg, Fla.

Betts, critical of himself earlier this week for his poor play to begin the season, went deep to dead center to lead off the eighth for a 5-4 lead, and Moreland followed with a blast to right-center as Boston snapped a three-game losing streak.

The Red Sox won a series opener for just the second time in seven tries this season.

Matt Barnes struck out two in a perfect bottom of the eighth, and Ryan Brasier worked around a hit batter and a wild pitch in the ninth for his fourth save. Brandon Workman (1-1) got the win in relief.

The Rays lost for just the third time in their past 11 games. Diego Castillo (0-2), who served up both eighth-inning homers, to the only two batters he faced took the loss.

Tampa Bay jumped ahead on a Brandon Lowe solo homer in the second, and Avisail Garcia hit a run-scoring triple in the third to make it 2-0.

But the Red Sox, limited to four runs during their three-game skid and hitless through the first four innings, broke through in the fifth. With one out, Rafael Devers doubled home J.D. Martinez, who had walked, and Christian Vazquez launched his third homer in the past five games for a 3-2 Boston lead.

After Martinez added a run-scoring single in the top of the sixth, the Rays took advantage of an error by third baseman Devers to tie the game in the bottom of the inning. Daniel Robertson busted an 0-for-21 slump with a two-run double down the line in left to make it 4-4.

Red Sox starter Eduardo Rodriguez allowed four runs (three earned) on seven hits and struck out six in 5 1/3 innings. After Rays opener Ryne Stanek pitched two scoreless innings, Ryan Yarbrough gave up three runs on three hits in three innings, striking out six.

Boston outfielder Andrew Benintendi returned to the lineup after missing three games with a foot contusion sustained on a foul ball last Sunday. He went 0-for-3.