ST. PETERSBURG, Fla. (AP) -- Derek 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.
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.
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.
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 (personal family matter) missed his second straight game.
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.
Rays: Tampa Bay begins its final home series of the season Friday night against the Chicago White Sox.