Tampa Bay's Alex Cobb and Detroit's Doug Fister engaged in a tremendous pitching duel until the Rays finally got to Fister in the ninth.
Sam Fuld reached on a bunt single to open the inning, moved to third on a base hit from Ben Zobrist and scored the first run of the game on the sacrifice fly to center by Joyce.
Zobrist took second base on the throw home, moved to third on a wild pitch and came in with the second run of the inning on Evan Longoria's single. A triple from Desmond Jennings then scored Longoria.
All three runs were charged to Fister (5-3), who retired only one batter in the ninth.
Cobb struck out seven over 7 2/3, but the win went to Joel Peralta (1-2), who fanned the only batter he faced.
Fernando Rodney came on in the ninth and put two runners on before collecting his 12th save.
Swim Week Miami Beach 2014 [PHOTOS]