NEW YORK — Derek Jeter was feeling nostalgic.

He homered for a big hit. He took part in Hideki Matsui's retirement ceremony. Then he watched Alfonso Soriano running up the first base line with his arms held out wide, flashing that electric grin.

"A lot of great memories here with Sori," he said, "and it was almost like old times."

The newly reacquainted duo created another memory Sunday.

Jeter connected on the first pitch he saw to give the Yankees a jolt in his return from the disabled list and Soriano made the captain a winner with a game-ending single that lifted New York over the Tampa Bay Rays 6-5 Sunday to avoid a three-game sweep.

Playing with Jeter for the first time since being re-acquired by New York from the Cubs on Friday, Soriano homered among his first four hits with the Yankees and drove in three runs.

"I remember from 2001 to 2003, nothing changed," Soriano said. "We get old but, more important, he loves the game, I love the game."

The 37-year-old Soriano and the 39-year-old Jeter were teammate from 1999 until Soriano was traded to Texas for Alex Rodriguez after the 2003 season, but they hadn't played together this season because Jeter was still out with a strained quadriceps. The Yankees lost Soriano's first two games and he was 0 for 8.

But Jeter was activated from the DL for the second time this month and homered against Matt Moore in the first, sending a drive to right-center that ended the Yankees' nine-game homerless drought. He went 2 for 4 and scored twice.

"He's a movie, that's what he is," manager Joe Girardi said.

Soriano gave it a happy ending.

Brett Gardner drew a leadoff walk from Jake McGee (2-3) in the ninth. McGee then switched belts on his uniform before facing Jeter, threw a wild pitch and received a visit from manager Joe Maddon.

The decision: walk Jeter intentionally.

"I don't want to name the manufacturer right now, don't want to cause any kind of disgrace or concern there, but I don't think I've ever seen that," Maddon said of McGee's belt, which broke at a crucial moment in the game.

After Robinson Cano struck out, Soriano hit a sharp bouncer up the middle for the win. He was mobbed by his teammates and doused with a liquid during a postgame interview.

Mariano Rivera (2-2), the Yankees' fourth reliever, got three groundball outs in the ninth.

Rookie Wil Myers homered twice and drove in four runs against beleaguered Yankees starter Phil Hughes and Kelly Johnson had an RBI double, but the AL East leaders lost for only the fourth time in 25 games.

Ichiro Suzuki had four hits and drove in a run on fellow Japanese star Matsui's bobblehead day. Matsui signed his retirement papers in an on-field ceremony before the game in front of the third sellout at Yankee Stadium this season, with Jeter standing alongside him.

"This is Matsui's day," Jeter said, "so everyone needs to focus on him."

Jeter's homer was the Yankees' first long ball by a right-hander since June 25, and his presence appeared to give the team an immediate lift.

"Just wave the magic wand," Andy Pettitte said. "It was cool."

After he homered and gave a quick wave of his cap from the dugout steps, Cano singled and Soriano followed with his first hit with New York in nine at-bats. Vernon Wells had a sacrifice fly and Suzuki had RBI single to make it 3-0.

Jeter started at shortstop for the first time this year. He was the designated hitter on July 11 when he returned from rehabbing the ankle he first broke during the opener of the AL championship series in October. He was sent right back to the disabled list when he strained his right quad running out a grounder. The Yankees won just four of 12 during his most recent absence.

"He's the face of the organization," Soriano said. "When he's on the field we can feel the energy."

Jeter's take: "It was fun — I'm tired. I worked hard to try to get back on the field."

Johnson, who drove in the run in Tampa Bay's 1-0 win Saturday, pulled Tampa within two on a double in the second and Tampa took the lead in the third.

Evan Longoria and James Loney singled with one out, then Myers laced a shot to deep left for a 4-3 edge.

But in the bottom half, Jeter opened the inning by lining a single that glanced off Johnson's glove behind second base. Girardi was concerned Jeter would overdo it on the bases, but the 13-time All-Star only needed another easy jog to score his second run.

Soriano sent him into a trot, eking a homer over the right-field wall just out of the reach of a leaping Myers.

"If I had one more step, I feel like I could catch that ball," Myers said.

Myers put another ball of his own out of everyone's reach in the fifth, an opposite-field shot to right for the first multihomer game of his career.

Plagued by home runs throughout his career, Hughes has allowed 20 this season. Often mentioned in trade rumors, Hughes yielded five runs and nine hits in four-plus innings and left to a vociferous Bronx cheer.

He was lifted after walking Matt Joyce in the fifth, and the New York bullpen shut down the Rays the rest of the way. Preston Claiborne, Boone Logan, David Robertson and Rivera combined on five innings of one-hit ball.

Moore's six-start winning streak ended when he was lifted after five innings with the score tied at 5. Moore allowed five runs and eight hits.

NOTES: Myers has a nine-game hitting streak. ... Yankees RHP David Phelps (forearm strain) said he will make his second rehab start Tuesday, for Double-A Trenton. ... Injured INF 3B Jayson Nix (strained right hamstring) should be activated when the Yankees visit the Dodgers on Tuesday. ... Rays INF Ben Zobrist was given the day off. ... Yankees OF Curtis Granderson (broken left pinkie), who could rejoin the team next weekend, was hitless in four at-bats, including two strikeouts, in his fourth game with Class A Tampa. He is 2 for 13 overall. ... A-Rod arrived at the Yankees complex in Tampa, Fla., around 5 p.m. and took BP and fielded grounders on the grass after the Tampa Yankees game.