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.

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.

More From 104.5 THE TEAM