A-Rod and Jorge Posada contributed to ending an awful stretch, on and off the field, for the New York Yankees.

Alex Rodríguez, who had been mired in a weeks-long slump, hit two home runs in Tuesday night's 6-2 victory over the Tampa Bay Rays.

Posada, who created a firestorm over the weekend when he asked out of a game after being dropped in the lineup, had two hits in the win.

The victory ended a six-game losing streak for the Yankees.

"We needed a win," Yankees manager Joe Girardi said. "It is a big win for us. I don't want to say must-win, but as close as you can get to a must-win in the month of May."

With Yankees managing general partner Hal Steinbrenner in attendance, New York ended its longest skid since dropping seven in a row from April 20-27, 2007.

"I think if we would have lost, we probably would have taken the bus all the way to Baltimore (for Wednesday night's game)," New York left fielder Brett Gardner joked. "A big win for us. Biggest win of the year."

Posada, the catcher-turned-designated-hitter, doubled and singled while batting seventh. It was his first start since the controversy over the lineup incident.

"To me, it was the place to put him today," Girardi said before the game. "There's a lot of things that I look at and I just thought it was the place to put him."

Girardi would not commit to Posada, who is hitless against left-handed pitching this season, being the everyday DH.

Posada was roundly booed before his first at-bat in the second, when he grounded out. The Yankees fans in attendance cheered in the fifth after he singled.

"It feels good to be back in the lineup and be able to contribute," Posada said. "To be able to be a big part of a big win. (It's great) to be able put everything away, behind you and go out there and play ball. It's one of those things that you're happy to be back in the lineup and it was a good feeling."

Rodríguez, who played third base Tuesday, has 621 career home runs. He recorded his first multi-homer game this season and 59th overall.

"They felt great," Rodríguez said. "It felt good off the bat. One was a changeup and then one was a fastball."

It was just his second multi-hit game since April 23 — he had hit .171 (14 for 82) with one homer and six RBIs since then.

"My struggles have been really unacceptable, but hopefully today was the start of good things to come," Rodríguez said.

Elliot Johnson homered for the AL East-leading Rays (24-18), who are 11-13 at home this season. Ben Zobrist had a run-scoring double in the ninth with two outs that resulted in the Yankees using closer Mariano Rivera to get the final out in a non-save situation.

Rodríguez tied it 1 with a fourth-inning homer and then put the Yankees ahead with a solo shot in the sixth off James Shields (4-2).

"It was one of those games where they were fighting for a win after six straight losses and they came out playing," Shields said.

Posada doubled and went to third on Gardner's bunt single in the seventh. Posada was replaced by pinch-runner Eduardo Nuñez, who scored on Chris Dickerson's single during a two-run inning that made it 4-1. Dickerson was called up from Triple-A earlier in the day when setup man Rafael Soriano was put on the disabled list.

The Yankees failed to score in the third with a runner on second and one out when Derek Jeter and Curtis Granderson struck out. In the bottom half, Johnson homered on a 3-2 pitch from Ivan Nova (4-3) as the Rays went ahead 1-0.

Gardner and Jeter both had RBI singles in the ninth.

David Robertson replaced Nova with the bases loaded and one out in the sixth and struck out B.J. Upton and Casey Kotchman.

"Big-time pitching to be able to do that," Girardi said.

Nova gave up one run and four hits in 5 1-3 innings. Shields, who entered 4-0 over his previous five starts, allowed four runs and eight hits over seven innings.

Jeter had one hit in five at-bats, striking out three times. The team captain stayed in the game after fouling a ball near his left knee during the fifth.

The game was delayed four minutes in the ninth when the umpires did a video review of a fly ball by Tampa Bay's Kelly Shoppach that Gardner caught. The original ruling was that the ball hit not strike an overhanging catwalk, which would have resulted in a home run, and that was confirmed.

Gardner briefly lost the ball and then overran it before making the grab.

"I don't think it hit anything," he said.

Based on reporting by The Associated Press.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino