Travis Shaw hit his first two major league homers and went 4-for-4 with five runs scored and four RBIs to lead the Boston Red Sox past the Tampa Bay Rays 11-7 on Saturday.

Xander Bogaerts had four hits and three RBIs, and Rusney Castillo three hits with three RBIs for the Red Sox, who their third straight after losing 12 of 14.

Logan Forsythe hit a solo homer and two-run single for the Rays, who have lost five of seven.

Joe Kelly (3-6), demoted to the minors in late June for nearly a month, gave up five runs on nine hits in five-plus innings for his first victory since June 6.

Jean Machi earned a save in his Red Sox debut, getting the final four outs.

After having their six-run lead sliced to one, the Red Sox scored two runs on one hit in the sixth against reliever Steve Geltz. Castillo had a two-run single that made it 9-6, with Shaw making a nice slide by tapping the plate with his hand despite the throwing beating him.

The Red Sox built a 6-0 edge after three innings against starter Matt Moore (1-3).

Leading 1-0 in the second, they scored four on Castillo's RBI double, Brock Holt's sacrifice fly and Bogaerts' two-run double.

Shaw, recalled earlier Saturday, homered over the Rays' bullpen, making it 6-0 in the third. His second - a two-run shot - went into the center-field bleachers in the eighth.

Moore, making sixth start since returning from Tommy John surgery in April 2014, gave up six runs in three innings. He's failed to go past five innings in since his return.

The Rays crept back with two runs in both the fourth and fifth.

But Bogaerts' RBI single made it 7-4.

The Rays then cut it to 7-6 on Kevin Kiermaier's RBI single and pinch-hitter Brandon Guyer's run-scoring double. Guyer's hit would have tied it but Kiermaier was caught trying to steal third.

Forsythe's single came in the fourth. Evan Longoria and James Loney each had RBI singles.

TRAINER'S ROOM

Rays: Steven Souza Jr. was hit by a fastball by Kelly and left in the sixth with a bruised left hand. ... OF Desmond Jennings (left knee bursitis) continues his rehab at Triple-A Durham. He went 0-for-3 with two walks on Friday. ... Drew Smyly (torn left labrum) made his second rehab start Friday, giving up five runs in 3 1-3 innings.

Red Sox: 3B Pablo Sandoval missed his second straight game with a bruised left forearm after getting hit with a pitch Thursday.

UP NEXT:

Rays: RHP Nathan Karns (6-5) is scheduled to pitch the series finale on Sunday. He's made 15 starts giving up two or fewer runs, which entered Saturday tied for the AL's most.

Red Sox: Wade Miley (8-9) is slated to start when they close a 10-game homestand. He's 0-2 in his last five starts.