Shields (16-12) yielded a pair of runs on six hits, walking three and fanning four for the Rays, who -- aided by Boston's loss to Baltimore Monday -- forged a deadlock with the Red Sox atop the AL wild-card standings with two games to play.
Kyle Farnsworth recorded the game's final out for his 24th save.
B.J. Upton stroked a game-tying two-run double in the third inning and came home on Johnny Damon's single while Kelly Shoppach added a solo homer for the Rays, who are trying to become the first team ever to overcome a nine-game September deficit to claim a playoff berth.
Starter Hector Noesi (2-2) lasted only two innings for the American League East champion Yankees.
Robinson Cano drove in both New York runs with a solo homer and an RBI single.