NEW YORK — Mark Teixeira rounded first base, raised his right arm in triumph and headed on a celebratory circle of the bases. New York Yankees fans called him out for a curtain call.

“I remember my first one,” he said, “and this may be the last.”

In the final weeks of a 14-year big league career, Teixeira broke open the game with a fourth-inning grand slam, and the surprising Yankees beat the Tampa Bay Rays 7-5 on a soggy Friday night to extend their winning streak to six.

Matching their longest streak this season, the Yankees (75-65) closed within one game of Baltimore and Detroit for the second AL wild card.

“We can taste it a little bit,” Teixeira said. “We’re hungry right now.”

In an unfamiliar role of chaser after a 9-17 start, New York has moved a season-high 10 games over .500 with an unexpected spurt that followed the release of Alex Rodriguez and the trades of Carlos Beltran, Aroldis Chapman, Andrew Miller and Ivan Nova.

Gary Sanchez, one of the Baby Bombers brought up from the minors as part of the youth movement, hit his 12th home run in 31 games, a drive into Monument Park behind the center-field fence in the third. The catcher also picked off a runner at second base from his knees.

In a 1-for-17 slump and playing with a bulging disk in his neck and cartilage tear in his right knee, Teixeira started for just the fourth time this month. He needs 90-120 minutes with trainers to prepare for a start, a routine that includes acupuncture, soft tissue massage, laser therapy, ultrasound and hot rub. And the Yankees want to give time at first base to rookie Tyler Austin.

Manager Joe Girardi looks at matchups and checks on Teixeira’s health before deciding who starts.

“I have to watch his knee. I have to watch his neck,” Girardi said. “Sometimes day games after night games are tough,”

Teixeira doubled off the left-field wall in the third against Blake Snell (5-8) and scored on a wild pitch. With New York ahead 3-2 in the fourth and two outs, the 36-year-old switch-hitter took a fastball away from reliever Kevin Jepsen for a called strike, then watched a changeup hit the dirt.

“In my mind, I’m like, he’s going fastballs away,” Teixeira said. “I said if he makes that same pitch, fastball away, I’m going to get out there.”

He got his bat head out early and drove a 94 mph fastball into the Yankees’ bullpen in right-center for his 12th home run this season, the 406th of his career, and his 11th big league slam.

“I didn’t know how many more grand slams I had left in me,” he said.

There were stoppages of 21 minutes in the fourth and 22 minutes in the sixth caused by brief light rain. As a downpour began in the ninth, umpires stopped play with a 2-2 count on Brad Miller after singles by Kevin Kiermaier and Evan Longoria off Dellin Betances put runners at the corners.

Betances stayed in after a 51-minute delay and struck out Miller. Logan Morrison hit an RBI single, and Betances fanned Stephen Souza Jr. at 12:11 a.m. for his career-best 10th save.

“I ran a bike for a little bit, got stretched, put some red-hot on my arm and just made sure I stayed as loose as I can,” Betances said.

Given a 7-2 lead, Yankees starter Michael Pineda lasted just 4 2/3 innings. When Girardi came to the mound with runners at the corners following a walk and an infield hit, Pineda avoided eye contact as he handed the ball to his manager, then walked slowly to the dugout as Chasen Shreve relieved.

“I’m a little surprised,” Pineda said. “A little frustration.”

New York was ahead 3-0 before Morrison and Souza hit consecutive home runs in the fourth. Tampa Bay scored twice in the sixth before Adam Warren (2-1) threw a called third strike past Logan Forsythe. Tyler Clippard got three straight popouts with two on in the eighth.

With each passing game, the Yankees sense they have a chance to reach the playoffs. Teixeira wants his finale to be in the postseason.

“I’m emptying the tank,” he said. “I want to be a big part of this team … whether it’s every other night, every third night, whatever it is.”

SMALL CROWD

The Yankees drew 30,194 after 27,532 on Tuesday and 27,631 on Thursday. Before the homestand, New York had topped 30,000 for every home game since September 2004.

“The landscape has changed a little bit. Some of the players the people used to come out and see a lot are no longer here,” Girardi said. “Some of these kids will build a reputation where people are going to get really excited. But part of it is school, too. I mean, that happens. So it will take some time.”

UP NEXT

RHP Masahiro Tanaka (12-4) starts for the Yankees on Saturday against RHP Chris Archer (8-17). Tanaka is 5-0 with a 2.08 ERA in his last six starts; Archer leads the major leagues in losses and strikeouts (211).