BOSTON — Mikie Mahtook hit a two-run homer and Matt Moore recovered from a difficult start to strike out seven as the Tampa Bay Rays beat the Boston Red Sox 5-2 on Tuesday night.

Moore (2-4) allowed two hits and walked two in the first inning as Boston took a 2-0 lead.

Boston rookie Henry Owens was perfect through four innings.

Logan Forsythe led off the fifth with a double for Tampa Bay’s first hit and he scored on a sacrifice fly. Owens (3-3) unraveled in the sixth.

Owens walked Richie Shaffer to start the inning and hit Brandon Guyer with one out. Mahtook singled to load the bases. Evan Longoria hit a sacrifice fly to right and Tampa Bay got another run when Mookie Betts’ throw home sailed high and ended up in the stands for a 3-2 lead.

Mahtook added two runs in the eighth with a homer that cleared the Green Monster in left field.

After not allowing a hit through four innings, Owens was tagged for seven before leaving after 7 1-3 innings. He struck out five and allowed five runs, four earned.

Moore allowed seven hits and didn’t give up another run after the first inning.

The Red Sox loaded the bases with one out and Travis Shaw drove in two runs with a single, his first of three hits.

Dustin Pedroia, who had three hits Monday in Boston’s 8-7 win, had the night off. Pablo Sandoval missed his second straight game with a respiratory infection.