BOSTON - Xander Bogaerts hit a grand slam in the eighth inning to lift Boston to an 8-7 victory over Tampa Bay on Monday night, moving the Red Sox out of the AL East's basement and ahead of the Rays.

David Ortiz collected his 99th RBI on a night he was honoured at Fenway Park for collecting his 500th career homer. It was his first home game since he joined the 500-home run club, hitting it against the Rays on Sept. 12.

Dustin Pedroia had three hits and Brock Holt drove in a run for Boston, which moved out of last place for the first time since June 8.

Brandon Guyer homered on the game's second pitch to spark a three-run first for the Rays, who lost for the seventh time in 10 games.

Richie Shaffer had a solo homer, and Evan Longoria and Logan Forsythe added run-scoring hits for the Rays.

Jean Machi (1-0) got one out for the win. Robbie Ross Jr. pitched the ninth for his fifth save.

Bogaerts homered off Brandon Gomes (2-6). Jackie Bradley Jr. was hit by a pitch and Mookie Betts and Pedroia singled before Bogaerts hit his homer over the Green Monster.

Tampa Bay scored three runs in the eighth after Boston had taken a 4-3 lead with three runs in the seventh. Grady Sizemore had a two-run double, and Longoria followed with a sacrifice fly.

In the seventh, Bogaerts had an RBI double high off the Monster. Ortiz's run-scoring grounder tied it before Travis Shaw's sacrifice fly.

The Rays had grabbed a 3-0 lead just nine pitches into the game against Eduardo Rodriguez.

Rays starter Chris Archer gave up one run and three hits in five innings despite control troubles. He walked five and threw two wild pitches.

Guyer's homer went completely out of Fenway, clearing the Monster seats.

TRAINER'S ROOM

Rays: OF Steven Souza Jr., who missed a little over a month with a broken left hand and came off the DL on Sept. 11, played 10 straight games and was out of the starting lineup. He came in defensively.

Red Sox: 3B Pablo Sandoval was out sick. Interim manager Torey Lovullo said he came in with a fever and was sent home. . Lovullo said INF Hanley Ramirez won't come off the DL until his right shoulder is "pain free."

UP NEXT:

Rays: LHP Matt Moore (1-4) is set to start Tuesday. He gave up Ortiz's 499th and 500th homers.

Red Sox: LHP Henry Owens (3-2) is slated to start. The 23-year-old rookie is coming off his best start when he held the Orioles scoreless over 7 2-3 innings.