The victory in the first game of a doubleheader assured New York of a playoff berth. It is the 16th time in the last 17 seasons the Yankees will appear in the post-season.
Desmond Jennings' two-run home run in the third inning put the Rays ahead 2-1 and the Yankees managed just four hits until the eighth off Tampa Bay starter James Shields (15-12).
Eduardo Nunez tied the score by leading off the New York eighth with his fifth home run of the season. After an out, Brett Gardner singled and Deter Jeter walked. Cano then sent a drive off the wall in center field, allowing Gardner and Jeter to score easily.
That handed the win to Luis Ayala (2-2), who struck out both batters he faced in ending an eighth-inning threat by the Rays. Mariano Rivera pitched the ninth for his 44th save this year and No. 603 of his career.
Alex Rodriguez delivered a first-inning single that scored Jeter in the first for the early New York lead.
Police: Sword-wielding man demanded free tacos
Puzzle-maker slips 'Murdoch Is Evil' into Rupert Murdoch's Sunday Telegraph