Upton ran for Joyce, advancing to second on a Sean Rodriguez single and to third on a Carlos Pena groundout. Bartlett then lifted a sac fly to right to hand Tampa Bay a victory in the first game of a key three-game set with American League East rival Boston.
The win enabled the Rays to jump over the Red Sox into second place by a half-game.
Randy Choate (2-2) got the last out of the seventh inning to collect the win and Rafael Soriano notched his 22nd save for Tampa Bay.
Eric Patterson went 3-for-5 with two solo homers for Boston.