Updated

A triple play in the sixth inning kept inning homer put them in front.

Both plays likely saved their season.

Joyce's three-run blast was the difference as Tampa Bay defeated the New York Yankees, 5-3, to stay tied on top of the race for the American League wild card berth.

"That was probably one of the most exciting times you could have on the baseball field," Joyce said.

Because of Boston's 8-7 defeat of Baltimore on Tuesday, the Rays and Red Sox remained even for the lead with one game to go.

A September-long slump by the Red Sox allowed the Rays to erase a nine-game deficit and have a chance to make the postseason. If the teams finish tied, there would be a one-game playoff Thursday at Tropicana Field.

After pulling even Monday, Tampa Bay made the most of its opportunity Tuesday. Ben Zobrist hit a two-run homer and, thanks to the triple play, starter Jeremy Hellickson limited the Yankees to three runs in six innings.

It was a 2-2 game entering the top of the sixth, when Alex Rodriguez led off with a walk and went to third on Mark Teixeira's double, setting the stage for a potentially big rally.

Nick Swisher then hit a long fly ball to center, but both runners held because it hung in the air. By the time the ball bounced in at the base of the fence, only Rodriguez could score.

Still, the play left runners on second and third, and an intentional walk to Jorge Posada loaded the bases.

Russell Martin followed by hitting a grounder tight to the line toward third base. Evan Longoria grabbed it as he stepped on the bag, fired to Zobrist for the second out, and Zobrist's relay to Sean Rodriguez was in time to beat Martin, who slid in head-first, to complete the play and got the Rays out of the jam.

The limited damage kept Tampa Bay in the game, and Joyce delivered the big blow an inning later.

Rafael Soriano (2-3) began the inning and walked B.J. Upton, who stole second before Longoria walked.

"It was the walks that killed him tonight," Yankees manager Joe Girardi said. "But if you're going to have it, get it out of the way tonight. That's for sure."

The Yankees reliever then left a 1-0 cutter up and over the plate, and Joyce crushed it to right to put the Rays in front. Their bullpen kept the lead safe. Brandon Gomes worked a flawless eighth and Kyle Farnsworth pitched a 1-2-3 ninth for his 25th save, while Jake McGee (4-2) got the win for a scoreless seventh.

Zobrist put the Rays on the board in the second inning, which Johnny Damon began with a single to move past Hall of Famer and Yankees great Lou Gehrig on the all-time hits list. Prior to the hit, they were tied for 57th with 2,721.

Yankees starter Bartolo Colon had Zobrist in a 1-2 count but dealt a fastball to the bottom inside corner of the zone, and Zobrist lofted it over the right field fence.

But those were the only runs Colon yielded in 5 1/3 innings, allowing the Yankees to tie the game. Martin homered to lead off the third and Brett Gardner scored on a double play grounder in the fifth.

Game Notes

The triple play was the third in Rays history, and first since September 2, 2006 against the Seattle Mariners at Tropicana Field...Colon allowed seven hits and walked two, while striking out three...Hellickson gave up six hits, walked five and fanned one...Zobrist's homer was his 20th of the season, the second time in his career he's reached that plateau. He hit 27 homers in 2009...No team has ever overcome a nine-game deficit in September to reach the postseason...Damon finished 1-for-4, and is two hits shy of tying Roberto Alomar...The Rays have won 29 consecutive games when scoring at least five runs.