The Yankees pulled to within 4 1/2 games of the Tigers for the second American League Wild Card spot.
"We know we can't waste any innings, and tonight I felt like we put together great at-bats from the first inning on to the eighth," said Brian McCann, who kick-started the offense by homering and driving in three runs.
Chris Young celebrated his move across borough lines by homering as part of a three-hit, two-RBI performance, and Mark Teixeira gave the Bombers the lead for good, legging out what was generously scored as a run-scoring triple as the Yanks overcame a deficit of four or more runs for the first time this year.
"I think it shows you the character of the guys in that room. They're going to keep fighting," Yankees manager Joe Girardi said. "That's what they did tonight, and they came back and won."
Anyone caught in traffic on the Major Deegan Expressway might have missed Chris Capuano's ineffective outing, the shortest of his career. The left-hander recorded just one out as the Rays batted around in the first inning, with Wil Myers, Yunel Escobar and Logan Forsythe collecting run-scoring hits.
The Yankees covered for him, scoring six unanswered runs off Tampa Bay starter Jake Odorizzi, who was knocked out in the fifth inning. New York's bullpen did excellent work, with five hurlers combining to toss 8 2/3 innings of one-run ball, beginning with Chase Whitley's emergency entry.
"When you come out in the first inning like that, your first thought is, 'Man, putting a lot of strain on that bullpen out there,'" Capuano said. "It's just amazing to watch those guys come in one after the next and get the job done. They just did an outstanding job."
Whitley whipped 2 2/3 scoreless frames, then handed the ball off to Preston Claiborne, who recorded six outs and picked up the victory. Adam Warren and Dellin Betances also worked scoreless ball before Esmil Rogers served up a ninth-inning homer to Evan Longoria.
"It meant a lot and it helps us a lot," Girardi said. "Whit was up and did a pretty good job for us earlier; Clay was up and did a decent job for us earlier in the year. To be able to get these guys to help us out with our schedule, 21 games in 20 days, we're going to need it."
McCann started the surge in the first with his 18th homer, 16 of which have come in the Bronx, then delivered a two-run single to trim the deficit in the third.
Young tied the game in the fourth with a solo homer to left field. Young had a disappointing season in Flushing, hitting .205 with seven homers in 88 games before being released, but he is off to a more productive beginning in the Bronx.
He became just the second player to homer for both the Mets and the Yankees in a single season, joining Dave Kingman (1977), according to the Elias Sports Bureau.
"It's a fresh start for me," Young said. "Whatever happened in the past really isn't on my mind. It's just about trying to come in here and hold your own and do your part to help this team as much as possible."
New York took the lead in the fifth as McCann was hit by a pitch, then chugged around the bases to score as Teixeira's triple -- his first since July 6, 2012 -- was kicked around in the right-field corner by Myers, knocking Odorizzi from the game.
"The loss is on me," Odorizzi said. "The whole team can point the finger in this direction. I'll accept it. I have to be accountable. We had a four-run lead, and I gave it up. And that's unacceptable."
"Sometimes four runs is all they need to win, but we've had that plenty of times," Teixeira said. "There's no panic, and we slowly got the job done as the game went on."
Chase Headley tacked on, greeting reliever Jeff Beliveau with an RBI single. Ichiro Suzuki and Young added run-scoring doubles in the eighth inning on a night when most of the breaks seemed to go the Yanks' way.
"It was amazing," Young said. "We have a resilient group of guys out there. I think the main thing is for the pitching staff to be able to come up and throw seven zeros on the board, just to give us the opportunity to get ourselves back in the game. It was huge for us."