In the eighth with the bases loaded, Posada came on to bat for Jesus Montero and punched a single to right off Brandon Gomes for a 4-2 lead.
Rafael Soriano then worked a scoreless ninth inning, and New York clinched the division thanks in part to Boston's loss to Baltimore on Wednesday. It is the 12th time in the past 16 years that the Yankees have won their division.
"It's always satisfying, but like I always say, you can't sit down and figure out what's going to happen before a season starts," Yankees shortstop Derek Jeter said. "You have to go out there and you have to play the games. We know how good everyone is in our division and the other teams are in baseball, but we had confidence in our own team."
The Yankees secured a playoff berth earlier in the day when Robinson Cano hit a two-run, go-ahead double in a three-run eighth inning to open the doubleheader with a 4-2 victory.
In the nightcap, CC Sabathia pitched 7 1/3 innings and gave up two runs on seven hits while striking out six and walking two. David Robertson (4-0) got Ben Zobrist to ground into a bases-loaded, inning-ending double play in the eighth to get the win.
"We have fought all year and we're able to persevere through it," said Sabathia as he was showered with champagne in the locker room. "We have veteran guys in here, especially in the rotation, and we got it done. But this is only step one."
The wild card chase is still in full swing, though, as the Rays remain 2 1/2 games back of Boston with the Angels tied with Tampa Bay.
"We were fortunate that the Orioles helped out once again," Rays manager Joe Maddon said. "At the end of the day, the effort was great, but once again the inability to get the big hit at the right time is kicking out butt a little bit."
Jeremy Hellickson threw seven innings and allowed two runs on a pair of hits with four walks and three strikeouts. Jake McGee (3-2) was tagged with the loss.
The start of the game was postponed 62 minutes due to rain, but it didn't seem to bother the Yankees much as they took the lead in the second inning when Cano led off the frame with a blast deep over the wall in right.
In the fifth, Curtis Granderson led off with a double. After a wild pitch, Mark Teixeira followed with a walk. Cano was intentionally put on to fill the bases, Montero hit into a double play to score Granderson for a 2-0 lead.
The Rays got one back in the fifth on a two-out homer from Shoppach. The visitors again went deep in the seventh to tie the game as Rodriguez hit a monster blast high off the left field foul pole for his eighth of the season.
New York has won nine of the 14 games against Tampa Bay this season...Cano has 27 home runs and 116 RBI on the season...The Rays batted 0-for-4 with runners in scoring position and stranded six...The Yankees have made the playoffs in 16 of the past 17 seasons...The Yankees are 14-7 this September...Sabathia is still one win away from consecutive 20-win seasons...Soriano notched his second save of the year...Cano leads the majors with 80 extra-base hits...The Rays have never swept a doubleheader against the Yankees, going 0-5-2.