ST. PETERSBURG, Fla. (AP) -- Derek Jeter almost felt as if he were playing in the Bronx after getting a key late hit.
The announced crowd at Tropicana Field was 31,042, the Rays' second home sellout this season. Tampa Bay entered with the major league's lowest average home attendance of 17,848.
''There are a lot of Yankees' fans down here because spring training is here,'' Jeter said. ''Seemed like quite a few were in the stands, so it's almost like a home game.''
Jeter is retiring after this season and playing in his final weekend games at Tampa Bay. The Yankees do return for three weekday games in September.
''I'm not so sure I've heard his name chanted that loud in an opposing stadium this year,'' Yankees manager Joe Girardi said.
Brett Gardner opened the ninth with an infield single off Jake McGee (3-1) and advanced on a throwing error by second baseman Logan Forsythe. After failing to lay down a sacrifice bunt, Jeter put New York ahead with a single to right-center on a 2-2 pitch.
''This game is funny, you know,'' Girardi said. ''It changes on a drop of a hat.''
Dellin Betances (5-0) worked a perfect eighth before David Robertson got three outs for his 32nd save.
Rookie Shane Greene allowed two runs, seven hits and struck out a career-high 10 in six-plus innings.
The Yankees took a lead in the second when Chase Headley drew a two-out walk on a full-count pitch and Martin Prado homered on an 0-2 offering from Drew Smyly, making his first home start since being acquired in a trade that sent ace David Price to Detroit on July 31.
Smyly gave up two runs and four hits over seven innings.
''They've got a really good lineup,'' Smyly said. ''They have good strike zone awareness. You just have to keep going right at them and making them swing.''
Price is scheduled to pitch against Tampa Bay for the first time Thursday in the finale of a three-game series in Florida.
After Yunel Escobar had a sixth-inning RBI single, Tampa Bay tied it at 2 on Ben Zobrist's run-scoring grounder in the seventh.
The Rays extended their club-record streak of allowing three runs or fewer to 12 consecutive games, but have gone just 7-5 over the stretch.
Tampa Bay had become the fourth team ever in the majors to get back to .500 after being at least 18 games under the break-even point with a 5-0 victory Friday night over the Yankees that gave them a 61-61 record.
Yankees: RHP Masahiro Tanaka (right elbow) threw 25 pitches during his first bullpen session since going on the DL July 9. C Brian McCann (concussion) might return Sunday.
Rays: OF David DeJesus (left hand) went 0 for 1 with a walk in his first Gulf Coast League game.
The Yankees captain has 20 career game-winning RBI hits against the Rays, which is second most against Tampa Bay. Boston's David Ortiz tops the list with 26.
Yankees RF Carlos Beltran played defense for the first time since mid-May. After a DL stint that went into early June due to a right elbow bone spur, he had been limited to DH. Beltran said he will have surgery on the elbow after the season.
ON THE MOVE
Tampa Bay recalled INF Vince Belnome from Triple-A Durham and optioned reliever Brandon Gomes to the International League club. Belnome went 0 for 2 with a walk.
Yankees RHP Hiroki Kuroda (7-8), 0-3 in his last four starts against Tampa Bay, and Rays RHP Jeremy Hellickson (1-1) are Sunday's scheduled starters.