The Yankees overcame a stellar outing by Rays starter Jeff Niemann to rally in the eighth inning and take a 4-2 win at Yankee Stadium with 45,848 watching.
Pinch-hitter Jorge Posada's three-run homer off Grant Balfour with one out in the eighth inning capped a four-run rally that erased a 2-0 Rays lead and helped write the final chapter of a four-game sweep.
"It was a huge hit for Posada," Yankees manager Joe Girardi said.
"I just haven't executed my pitches -- I've been terrible," said Balfour, who suffered his third blown save in a week. "I've been really terrible. I don't know what to tell you. I hope it turns around quick. I'm sick and tired of going out there and throwing like this.
"I've had great stretches when the game feels easy. These last two weeks, you realize how tough the game can be on you sometimes. You make a mistake, and you get hurt."
In defeat, the Rays extended their season-high losing streak to eight games, making their chances of catching the Red Sox for the American League Wild Card spot look even more dire, as they fell to 9 1/2 games back with just 22 games remaining in the season.
Winning seemed like a bonus to Yankees fans on Wednesday night, as they came to the Bronx to see Derek Jeter chase Lou Gehrig's franchise hits record. The Yankees' shortstop caught the Iron Horse with his third hit of the game -- and 2,721st of his career -- a single to right field in the seventh inning.
Niemann, who continued to state his case for AL Rookie of the Year honors, entered the eighth inning with a shutout, but then allowed a leadoff single to Alex Rodriguez before being lifted.
"I felt pretty good tonight," Niemann said. "My splitter was big for me. I got some punchouts on it early. I felt pretty comfortable out there.
"They're a great team -- one through nine, they can hurt you. It was a good ballgame until the end, and we came up a little short."
Once Niemann left, a parade of Rays relievers followed, including Lance Cormier, Brian Shouse, Balfour and Randy Choate.
Balfour's mistake to Posada perpetuated a bad run by the Rays' bullpen that has seen the group post a 2-11 record since Aug. 6. Posada's homer came the night after Nick Swisher hit a walk-off homer off Dan Wheeler.
"We're having a hard time, and it's not just the base hit -- it's the homer," Rays manager Joe Maddon said. "We're giving up three-run homers, grand slams. The homer has really bitten us late, and it's throughout the whole group.
"But, again, [we scored] two runs today, two runs yesterday, one run the day before. We have to score more runs. We're putting so much pressure on the end of the game where we're just not picking up enough of a lead where you can have some kind of cushion."
The Rays' only runs came in the first inning. Jason Bartlett led off the game with his 14th homer of the season, and Pat Burrell added an RBI single to give Tampa Bay a 2-0 lead.
Bill Chastain is a reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.