NEW YORK — Tyler Austin wasn’t sure if Yankees manager Joe Girardi would let him face a right-hander in the ninth inning.

Switch-hitting veteran Mark Teixeira was still on the bench, and the right-handed hitting Austin isn’t far removed from a long slump.

Girardi stuck with the rookie, and he came through, helping the Baby Bombers continue their unlikely push into postseason contention.

Austin hit a solo homer in the ninth to give New York its season-high fifth straight victory, 5-4 over the Tampa Bay Rays on Thursday night.

Brian McCann hit two homers for the Yankees, who moved a season-high nine games over .500 (74-65).

After blowing three leads during the first six innings, New York moved within two games of Baltimore for the second AL wild card and four games of AL East-leading Boston. Resurgent New York plays 20 of its remaining 23 games against division opponents, putting it in position to compete despite selling off key pieces at the Aug. 1 deadline.

“I think everybody in this clubhouse believes that we can make a push at this thing and get in the postseason,” Austin said. “It’s an exciting time right now.”

Austin homered off Erasmo Ramirez (7-11) on a 3-2 pitch for his third homer since being called up Aug. 13. Teammates met him at home plate by dousing him with water in a raucous celebration.

“That was a huge team win for us,” Austin said, “and a special moment.”

A long one coming, too. Injuries and poor performance slowed Austin’s climb through the minors, and in 2015, he was demoted from Triple-A to Double-A during the season. He opened back at Double-A Trenton again this season, a disappointing assignment, but then forced his way to the majors with his bat.

“I didn’t give up, kept battling and you know, here we are,” he said.

After homering in his big league debut, Austin entered a 4-for-33 slump that ended Sunday. He since has a five-game hitting streak.

Girardi decided to let the 25-year-old Austin bat because Ramirez has better numbers against left-handed hitters.

“And he’s in the game,” Girardi said of Austin. “A lot of times it’s a lot easier if you’re in the game.”

The pesky Rays kept coming back, getting two homers each from Kevin Kiermaier and Steven Souza by the sixth. This was the first game this season in which three players had multiple homers, per the Elias Sports Bureau.

MAC ATTACK

McCann’s homer in the second landed in the luxury suites just below the third deck in right field. His second put the Yankees up 4-3 in the fourth, giving him 19 for the season.

The left-handed slugger is one shy of his ninth straight 20-homer season and 10th overall but entered on a 3-for-20 slide.

“You want to pull your weight around here,” McCann said. “For a large part of the season, I haven’t been doing that. So tonight was nice to get to some baseballs and backspin them.”

WELCOME ABOARD

Tampa Bay hit four homers after being joined by new hitting coach Chad Mottola earlier in the day. Mottola was promoted from minor league hitting coordinator after Tampa Bay fired Derek Shelton on Tuesday.

Kiermaier homered twice in the first three innings, setting a career high with his 11th homer in the third. He’s hit safely in a career-best 12 straight games, the longest streak by a Ray this season.

Souza had his third multihomer game of the season, and second at Yankee Stadium.

‘PEN GAMES

New York had to use five relievers on a night when its bullpen was already short-handed. Girardi hoped to avoid using Dellin Betances, Tyler Clippard, Adam Warren and Luis Severino, so he had to dig deep in the bullpen when CC Sabathia went just four innings, allowing three homers while throwing 87 pitches.

Girardi was still aggressive matching up his left-handed relievers, including when Tommy Layne (2-1) entered and struck out pinch-hitter Logan Morrison to end the ninth.

BACK IN THE GROOVE

Alex Cobb made his second start since having Tommy John surgery and allowed four runs over six innings. He gave up two homers and threw 89 pitches.

“He’s around the strike zone, extremely efficient, kept his pitch count down, gave us every opportunity to win,” manager Kevin Cash said.

A SMALL PARTY

The paid attendance was 27,631, under 30,000 for just the second time at Yankee Stadium — the first was 27,532 on Tuesday. That was the first time under 30,000 since 2004.

BALK BACK

Umpires called Yankees reliever Jonathan Holder for a balk that let in a run in the fifth inning, then overturned the call.

Holder motioned with his glove for McCann to show him the signs again, and first base umpire Jordan Baker called a balk, allowing Logan Forsythe to score from third.

The Yankees argued, and the umpires conferred before overturning the decision.

TO THE BALLOTS

The Staten Island Yankees, one of New York’s Class-A affiliates, are holding a fan vote to decide on a new team name. The options are: Bridge Trolls, Island Heroes, Killer Bees, Pizza Rats and Rock Pigeons.

TRAINING ROOM

Rays: SS Matt Duffy will have surgery Friday on his left heel. Dr. Bob Anderson, team orthopedist for the NFL’s Carolina Panthers, will perform the operation. … RHP Chase Whitley is expected to return following Tommy John surgery in one of the next three games. Whitley pitched for the Yankees in 2014 and ’15 but was placed on waivers and claimed by Tampa Bay last November while recovering from the surgery.

UP NEXT

Rays: Rookie LHP Blake Snell (5-7, 3.39) starts vs. New York on Friday night. He struck out seven over six innings of one-run ball in a win against Toronto last time out and has a 2.61 ERA in two starts against New York this season.

Yankees: RHP Michael Pineda (6-11, 5.10) pitches against Tampa Bay. Pineda is 0-1 with a 7.04 ERA over his past three starts.