The Rays hold one of three AL wild-card spots in a tight race that also includes Seattle, Toronto and Baltimore.
With the Rays trailing 3-2 in the seventh, pinch hitter Vidal Bruján was hit by a pitch from Jeurys Familia (2-2) and stole second. Bruján advanced on a groundout and scored on Margot’s double off Familia.
One out later, Peralta hit an RBI double over first base off Zack Kelly to give Tampa Bay a 4-3 lead.
Calvin Faucher (2-3) got the win in relief after striking out Trevor Story with the bases loaded in the seventh. Pete Fairbanks pitched the ninth for his fifth save in five attempts.
Margot and Peralta each had two of Tampa Bay’s nine hits to help the Rays win for the 12th time in 15 games.
Red Sox starter Michael Wacha struck out seven as he tried to win a fifth straight start. He allowed two runs on seven hits, leaving after six innings with a 3-2 lead.
Rays starter Luis Patino, recalled Monday after making two starts for Triple-A Durham, pitched five innings, allowing three runs on five hits and three walks. Two of the walks proved costly, coming before RBI hits by Rafael Devers and Story in the third that gave the Red Sox a 3-1 lead.
Alex Verdugo homered off Patiño, his ninth of the season, to put Boston up 1-0 in the first.
Harold Ramirez hit an RBI single in the bottom half and Randy Arozarena cut it to 3-2 with an RBI double in the fifth.
Red Sox: LF Franchy Cordero left in the fifth with a sprained right ankle after hitting the wall chasing down Arozarena’s double. … DH JD Martinez sat out for the second straight game with a stiff back.
Rays: To open up a roster spot for Patiño, the Rays designated RHP Matt Wisler for assignment. … Wander Franco (right hook to broken hamate) was scheduled to play seven innings at shortstop in a rehab game for Triple-A Durham.
Rays RHP Drew Rasmussen (9-4, 2.70 ERA) makes his first start of September Tuesday night after being selected as the AL pitcher of the month for August. LHP Rich Hill (6-5, 4.52), who hasn’t allowed an earned run in 11 innings in two starts against Tampa Bay, will pitch for the Red Sox.
More AP MLB: https://apnews.com/hub/mlb and https://twitter.com/AP_Sports