ST. PETERSBURG, Fla. (AP) Derek Jeter managed to get a hit that had been most elusive.
Jeter ended an 0-for-28 slump that was the second-worst of his career, and the New York Yankees beat the Tampa Bay Rays 3-2 Wednesday night.
The retiring Yankees captain lined a single off Alex Cobb leading off the sixth inning. Jeter had an 0-for-32 stretch in April 2004.
''I'm one for my last two, guys,'' Jeter said. ''It felt good, man.''
Jeter, who lives in nearby Tampa, went 1 for 4 and scored a run in his final game at Tropicana Field. He got a loud ovation from the announced crowd of 26,332 before grounding out in his last at-bat in the seventh.
New York manager Joe Girardi was relieved that Jeter got a hit.
''It was good to see,'' Girardi said.
The Yankees began the day six games out of the second AL wild-card spot, with four teams ahead of them.
Brandon McCarthy (7-4) allowed two runs and four hits in seven innings. Dellin Betances and David Robertson, who got his 37th save, completed a five-hitter.
Cobb (9-8) had his streak of allowing two runs or less in 12 consecutive starts - tied for third-best by an AL pitcher in 100 years - come to an end. He gave up three runs and four hits over six innings.
Evan Longoria hit a solo home run and had RBI grounder for the Rays. He has 46 RBIs in 56 games since the All-Star break.
Chase Headley and Brendan Ryan hit run-scoring doubles in the fifth that put the Yankees up 2-1. Brett Gardner hit a bases-loaded sacrifice fly in the sixth that was caught by a leaping Wil Myers at the right-field wall.
Cobb hit Chris Young on the lower back with a pitch leading off the fifth, but things remained calm. A day earlier, Jeter was hit on the left hand by Steve Geltz in the eighth, then Yankees reliever David Phelps was ejected in the bottom half for throwing a tight pitch to Kevin Kiermaier.
''It was the beginning of that inning where I did lose command,'' Cobb said. ''I just fell into a bad habit. It was myself not making proper adjustments. I heard the boos, but that's just unknowledgeable baseball fans, if I dare go there.''
Cobb took a no-hitter in the eighth inning of his start last Thursday night at Yankee Stadium.
Six New York batters have hit by a Rays pitcher in the past week.
Alan Porter was the plate umpire in place of Joe West, who was suspended for one game without pay for grabbing the jersey of Philadelphia closer Jonathan Papelbon on Sunday. Sean Barber joined the crew and was at third base.
Yankees: 1B Mark Teixeira (sore right wrist) played after missing Tuesday's game. ... DH Carlos Beltran, who left the team Tuesday, posted on Facebook that he and his wife had lost their unborn son.
''It puts things in perspective,'' Jeter said. ''The bottom-line, family is most important.''
HIGH AND TIGHT
Girardi is unhappy that some of the recent hit by pitches by the Rays players came on high pitches.
''When you talk about pitching high and inside, I mean there's elevated `in' and then there's throwing up at somebody's head,'' Rays manager Joe Maddon said. ''But believe me, man, I would never tell the Yankees how to train their pitchers.''
Jeter is hitting .167 (23 for 138) with no homers and 10 RBIs since former Yankees teammate Joba Chamberlain hit him near the left elbow with a 93 mph pitch during the 10th inning of a game against Detroit on Aug. 5. Before getting hit, Jeter was batting .277 with three homers and 30 RBIs.
Yankees: Jeter starts his final homestand Thursday night. RHP Shane Greene (5-3) and Toronto knuckleballer R.A. Dickey (13-12) are the scheduled starters.
''I don't really know,'' Jeter said on what his final games at Yankee Stadium will be like. ''I try not to anticipate anything. We'll find out.''
Rays: Tampa Bay begins its final home series of the season Friday night against the Chicago White Sox.