Jorge Posada led off the 10th inning with a pinch-hit homer, lifting the New York Yankees over the Tampa Bay Rays 8-7 and back into first place in the AL East on Tuesday night.

Robinson Cano and Alex Rodriguez also homered for the Yankees, who squandered a six-run lead before tying it at 7 in the sixth on Cano's RBI double. Posada drove a 2-0 pitch from Dan Wheeler (2-3) over the center field wall, setting off cheers from a large contingent of New York fans among the crowd of 28,713 at Tropicana Field.

The Rays erased the 6-0 deficit with a seven-run fifth inning that Willy Aybar finished with a three-run, pinch-hit homer off Boone Logan. Slumping slugger Carlos Pena began the rally with his first homer since Aug. 30.

David Robertson (4-4) pitched the ninth and Mariano Rivera finished up for his 30th save in 33 opportunities. A night after Reid Brignac's 11th-inning homer gave Tampa Bay a 1-0 lead and put the Rays atop the standings by one half-game, the Yankees stopped a season-high four-game losing streak and regained the division lead.

Cano hit a two-run homer off Rays starter Matt Garza in the third and delivered his game-tying double off Jeremy Hellickson. Rodriguez also went deep against Garza, hitting his 606th career homer in the fifth.

Rodriguez also had a RBI single in the third before scoring on Cano's 27th homer of the season. Cano's run-scoring double in the sixth gave the All-Star second baseman a career-best 98 RBIs.

The Rays threatened in the 10th with Carl Crawford reaching on a broken bat single and stealing second with one out. Rivera escaped, though, when Matt Joyce flied to right fielder Greg Golson, who threw out Crawford trying to advance after the catch.

Mark Teixeira's sacrifice fly during a four-run third snapped a string of 16 consecutive scoreless innings for the Yankees that began in the seventh inning of Sunday's 4-1 loss at Texas. Cano's homer ended the team's longest homerless drought since it went four games without one from June 19-22, 2008.

Garza allowed six runs and nine hits over 4 2-3 innings. The outing came on the heels of another poor performance in which he blew a 4-0 lead while yielding four homers and six runs overall in 4 1-3 innings of an 11-5 loss at Boston.

Yankees starter Ivan Nova limited the Rays to Carl Crawford's first-inning single and a pair of walks until Pena began Tampa Bay's big inning with his 27th homer. John Jaso, Evan Longoria and Joyce followed with RBI singles before the second pinch-hit homer of Aybar's career.

Nova, who allowed six of eight batters to reach base in the fifth, gave up six runs and six hits in 4 2-3 innings. Logan had not given up a run in 25 consecutive appearances, the second-longest scoreless stretch for a Yankees pitcher since 1920.

A night after being held to four singles by David Price and three Rays relievers, the Yankees had 13 hits and stranded 11 runners. After Rodriguez's homer made it 5-0, they loaded the bases twice but only got one run of it.

Rookie Jake McGee, making his big league debut for Tampa Bay, walked Colin Curtis on four pitches to load the bases in the fifth, then walked Francisco Cervelli on five pitches to force in the run that made it 6-0.

Rays reliever Chad Qualls worked out of bases-loaded jam by striking out Austin Kearns and getting Curtis to fly to center field to end the sixth.

Notes: Cano had gone 53 at bats since last homering on Aug. 30. ... With Pena struggling at the plate, Tampa Bay dropped him fifth to seventh in the batting order. He began the night in a 2 for 38 slump and batting .200, lowest in the majors among qualifiers. ... Yankees RF Nick Swisher was out of the starting lineup for the third straight day, but got an encouraging report after an MRI on his injured left knee. He had a test that showed inflammation, but no structural problems. He received a cortisone shot and will likely be out of the lineup until this weekend. ... New York OF Brett Gardner also was out because of a sore right wrist.