By winning, the Rays (75-61) moved to within 1 1/2 games of the Yankees and the Orioles, who moved into a tie for the American League East lead with their 12-0 win over the Blue Jays on Tuesday night.
Cobb retired the first two batters of the game before falling behind to Nick Swisher, 2-0. That turned into a walk, and Cano made Cobb pay when he belted his 29th home run of the season on a 2-1 count.
"The at-bat [before Cano] and [Cano's at-bat] were just two mental mistakes," Cobb said. "I can't walk Swisher, put a guy on, to get to Cano. Then, throwing him two fastballs belt high, that's what he's dreaming about there."
The Rays answered in the bottom of the first when B.J. Upton doubled home Desmond Jennings.
Big flies by the home team followed.
Evan Longoria's 10th home run of the season came in the third with a man aboard to give the Rays a 3-2 lead. And additional thunder echoed inside The Trop in the fifth when Jennings and Upton hit back-to-back homers to put the Rays up, 5-2.
"It's another home run," said Upton of his 18th home run of the season, a 430-foot blast that cleared the wall in center field. "I'm just glad I could put a run on the board and give us a little bit of a cushion, especially after Desmond hit his.
"For us to go back-to-back in that situation and give us a three-run lead, it definitely let Alex go out there and pitch his game and go right at guys. A couple 1-2-3 innings after that, that was big for us."
The Rays had not hit back-to-back home runs at Tropicana Field since Carlos Pena and Ben Zobrist turned the trick on June 9, 2010, against the Blue Jays.
Meanwhile, Cobb stopped the Yankees after the first, holding them to just three more hits and striking out five en route to his ninth win of the season. The right-hander retired 14 of the last 15 batters he faced, including the final 10.
"All day, it was exciting; it was the closest thing I've had to a playoff game," Cobb said. "It was a lot of fun to go out in that environment and go out and pitch well. ... You try to keep an even keel throughout the whole season, but there was definitely an added focus factor to each and every pitch."
Derek Jeter complimented Cobb for doing a "nice job" of mixing up his pitches and not leaving many of his offerings lingering across the plate.
"We scored those two runs early, but you've got to come and score a little bit more," Jeter said. "You want to make your pitching staff a little more comfortable, but we didn't do it. We have to find ways to score more runs."
The contrast between the Rays and Yankees at this juncture of the season is striking. On July 18, New York held a 10-game lead in the AL East; the Rays trailed by 10 1/2 games on that date. Since then, the Yankees have gone 19-25 and seen their lead evaporate. New York manager Joe Girardi appeared to be feeling the heat on Tuesday when he got ejected after a called third strike ended the top of the fourth.
Inside the home clubhouse, the atmosphere seemed loose.
"I think we said from the start of Spring Training this is how it was going to be," Upton said. "I know a lot of people on the outside kind of wrote it off when you're looking up and you're 10 1/2 games out. All of us in here have been around long enough to know that this is a long season. A lot of things can happen, especially with the second Wild Card in place.
"We've kept our cool, kept our heads in it and we find ourselves a game and a half out in September -- still a long way to go. We have another head-to-head series at their place and a pretty tough schedule. We know what's ahead of us, so we've just got to take it day by day."
Upton was asked if he was surprised by the Yankees blowing a 10-game lead.
"After last year, not at all," Upton said. "You just never know what's going to happen. I think a lot of us have learned that. We'll see what happens down the stretch."
Rays manager Joe Maddon refused to dance on the Yankees' grave, calling the Bronx Bombers a very good team but noting they're "hurting" right now.
"They're not at full strength, obviously," Maddon said. "But they're still really, really, really, good. So you have to be really careful with that lineup. It's formidable. They're not 100 percent healthy. We were not at the early part of the season, so it's the ebb and flow of the year."