NEW YORK -- Rookie Tyler Austin homered with two outs in the bottom of the ninth inning lifting the New York Yankees to a 5-4 victory over the Tampa Bay Rays on Thursday night.
The Yankees nearly won it on the second pitch of the ninth but Brian McCann flied out to the warning track in right field. After Chase Headley popped up Erasmo Ramirez (7-11) replaced Enny Romero.
Austin quickly ended it by pulling a full-count fastball into the right-center field seats.
Austin's third home run and first career walk-off hit helped the Yankees (74-65) win their fifth straight game and improved them to 11-4 in their last 15 contests.
New York moved to within two games of idle Baltimore for the second wild card and four of idle Boston for first place in the American League East.
The Yankees used five relievers after CC Sabathia lasted four-plus innings. Tommy Layne (2-1) struck out pinch hitter Logan Morrison for the final out of the ninth for the victory.
Three players hit two home runs.
Kevin Kiermaier had his first career multi-homer game and Steven Souza Jr. recorded his third for Tampa Bay.
Brian McCann hit two solo home runs for the Yankees for his 14th career game with two homers.
Gregorius had an RBI single and New York's other run scored on a throwing error by Tampa Bay starting pitcher Alex Cobb on a pickoff throw.
The Yankees held a 4-3 lead through five innings after McCann's second home run but Souza evened the game with one out in the sixth by hitting a mammoth home run against rookie Jonathan Holder off the top of the sports bar beyond the center field wall.
Cobb allowed four runs (three earned) and nine hits over six innings in his second start back from Tommy John surgery.
Sabathia allowed three home runs for the 13th time in his career. The left-hander lasted four-plus innings and allowed three runs and seven hits before getting lifted two batters into the fifth.
Tampa Bay took a 1-0 lead when Kiermaier drove a 2-1 pitch into the second deck in right field with one out in the first. The Yankees scored twice in the first on an RBI single by Gregorius and a throwing error by Cobb on a pickoff play at first.
The teams traded leadoff home runs in the second.
The Rays tied it when Souza opened the second by driving a 2-0 pitch into the New York bullpen beyond the right center field fence. McCann gave New York a 3-2 lead when he drove a 1-0 fastball into the second deck in right.
Kiermaier began the third by lifting a 1-2 pitch into the right field seats for a 3-3 tie. The game stayed tied until McCann lifted a 1-2 fastball into a similar location as Kiermaier's second home run with one out in the fourth.
Tampa Bay appeared to tie it when Logan Forsythe scored on a balk by Jonathan Holder with two outs in the fifth. Yankees manager Joe Girardi asked the umpires to consult with each other and the call was overturned.
NOTES: Chad Mottola became the seventh hitting coach in Tampa Bay history and said he is familiar with OF Mikie Mahtook and 3B Richie Shaffer from their time together with Triple-A Durham. Mottola also said he knows IF Brad Miller and UTL Nick Franklin since all three are from Orlando Fla. ... The Rays signed SS Alexi Ramirez and added him to their active roster. Ramirez was released by the San Diego Padres on Sunday. ... Asked about Tim Tebow signing with the New York Mets Yankees manager Joe Girardi said: "I'd be shocked if he's not rusty but the Mets thought enough of him to sign him so I'm curious. I'm going to watch and pay attention to see how he does. I think it's a good story."