Wells then pinch-hit for Chris Stewart and blasted a pitch to the base of the right-center field wall. All three runners were allowed to score after umpires ruled a fan interfered with the ball as it one-hopped toward the first row of stands.
Rookie Zoilo Almonte contributed three RBI for New York, which took a second straight from the Rays.
CC Sabathia (8-5) got the win despite allowing five runs on six hits over seven innings, walking two and striking out two.
Mariano Rivera racked up his 26th save for the Yankees.
Rookie Wil Myers went 3-for-4 with a grand slam in his sixth major league game and Evan Longoria also went deep for Tampa Bay.