The win earned the Yankees a split of the twin bill after the Rays took a 7-1 win in the afternoon contest.
The Rays' loss snapped their three-game winning streak, and they moved to 3-5 on their nine-game, 10-day road trip that comes to a close Sunday. The split, combined with the Red Sox's split with the Blue Jays, left the Rays two games ahead in the American League East while reducing their magic number to 14. Any combination of Tampa Bay wins and Boston losses totaling 14, and the Rays will become AL East champions.
The telling moment for the Rays (88-58) came with one out in the seventh, when Ben Zobrist fielded Bobby Abreu's grounder and Tampa Bay's shortstop threw wild to second base on a potential double-play ball. Derek Jeter scored from first base on the play to tie the game at 4.
"Just a physical mistake," Zobrist said. "It happens -- happens every once in a while. I've been playing good defense lately and I picked a bad time to have a physical mistake there.
"It's just kind of one of those things where you can't analyze it too much. I get my work in on flips and stuff like that. It just slipped out of my hand."
Xavier Nady then singled home Abreu with the go-ahead run when he threaded a two-out hit up the middle to give the Yankees a 5-4 lead. Abreu added an RBI single in the eighth for a two-run cushion, which the Yankees needed, as Evan Longoria's pinch-hit single in the ninth against Mariano Rivera drove in Gabe Gross to cut the lead to 6-5. But Rivera recovered to preserve New York's win and earn his 34th save of the season.
"Any time you're up in a game and you blow a lead or things happen, you feel like you lost an opportunity," Zobrist said. "We could have gained maybe another game if [the Red Sox] lost and we had won. It would have been nice to take that one tonight. But you know, we have a lot of faith in each other -- to pick each other up. I know these guys are going to pick me up. Everybody picks each other up when they make mistakes, whether they're physical or mental. We can't dwell on what happened today. We just have to be ready for tomorrow."
Zobrist, who hit a grand slam against the Orioles on Aug. 29, connected on a 1-2 pitch from Sidney Ponson with two outs in the fourth inning and deposited the ball into the right-field stands for his eighth home run of the season -- and second grand slam -- to put the Rays up, 4-1.
Alex Rodriguez's sacrifice fly in the first inning -- following a balk by Rays starter Matt Garza that put two runners in scoring position -- gave the Yankees a 1-0 lead. Then, trailing 4-1, New York (78-70) added two in the fourth on a solo home run by Wilson Betemit and a Brett Gardner groundout to cut the Rays' lead to 4-3.
Garza did not have his best stuff, but he managed to hold the Yankees to three runs in five innings and left with the Rays holding the 4-3 lead.
"I thought I threw well and gave us a chance to win, but they just came up with clutch hits at the right time," Garza said.
Rays manager Joe Maddon said his club simply made too many mistakes.
"That wasn't our typical game," Maddon said. "We just made mistakes, and that's what beat us. ... That happens, it was a long day. We just didn't have one of our better days."
James Shields pitched eight scoreless innings to lead the Rays to victory earlier in the day. The Rays right-hander looked sharp throughout his outing, allowing just five hits and no walks to earn his career-high 13th win of the season against eight losses.
Also in the first game, Longoria returned to action for the first time some coming off the disabled list Sunday. He went 2-for-4 with two RBIs and made a dazzling play in the field that saw him dive to backhand a smash by Nady in the sixth, then throw a strike to first to end a potential Yankees scoring threat.
Bill Chastain is a reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.