NEW YORK -- The ball flew off his bat, over the wall in right for a game-tying homer in the ninth, and Raul Ibanez felt everything start to go in slow motion.
He would send his New York Yankees into fast-forward three innings later with a walk-off single that led to another wild celebration at Yankee Stadium.
Three outs from dropping into a tie for the American League East heading into the season's final day, Ibanez's clutch hits gave New York a crucial 4-3 win over the Boston Red Sox on Tuesday.
Ibanez's two-run pinch-hit homer off Red Sox reliever Andrew Bailey tied the game in the ninth and his two-out RBI single off Andrew Miller in the 12th won it on a rainy, misty night at Yankee Stadium.
The Yankees erased a two-run deficit in the ninth on a night when Boston Red Sox second baseman Dustin Pedroia doubled in a run while playing with a broken left ring finger, after Boston's weak lineup during Monday night's loss raised eyebrows.
The victory maintained New York's one-game lead over the Baltimore Orioles heading into the regular season's final day.
"If you win, you win the division," Yankees manager Joe Girardi said, a little while after the Yankees mobbed Ibanez after his game-winning single to left. "That's the bottom line."
Ibanez's single off Miller (3-2) scored Francisco Cervelli, who walked in his first plate appearance of the season. Curtis Granderson, who singled to start the ninth-inning rally, also walked to extend the 12th.
Yankees reliever Derek Lowe (9-11) pitched two scoreless innings to get the win.
"I think it's the character of the team," Ibanez, who also hit a huge homer in the Yankees' epic 14-inning game against the Oakland A's last month, said of the latest comeback. "It's a bunch of resilient guys, and guys who fight."
The Orioles had already beaten the Tampa Bay Rays 1-0 to move within a half-game of the Yankees, who entered the ninth down 3-1.
But Granderson led off the inning with a single, and Ibanez pinch hit for Eduardo Nunez. The veteran then drove a 1-2 pitch from Bailey over the wall in right to tie the game.
"It's almost in slow motion," Ibanez said. "You hit it and you see the ball take off and it's all kind of happening in slow motion."
Bailey lamented the fact Pedroia had stepped up, despite his injury, along with starter Jon Lester and the Red Sox relievers, only to have him give away the lead.
"Threw it right down the middle. There's nothing else to it," he said. "... You've got guys like Pedroia going out there, playing with broken hands, broken fingers, whatever he has, getting that big double, Jonny throwing a hell of a ballgame, bullpen coming in and doing their job. I didn't. I've got to get back to just getting people out."
The Red Sox escaped more trouble in the ninth, though, as reliever Mark Melancon came on with one out and the bases loaded to extend the game. Melancon got Mark Teixeira -- who had killed rallies all night -- to fly out to shallow center without scoring a run. He then got red-hot second baseman Robinson Cano to ground out to end the inning.
The lost opportunity could be especially costly Wednesday, as it resulted in the Yankees using closer Rafael Soriano for a second inning. Soriano threw 43 pitches while throwing two innings for the first time since June 19, 2010, but Girardi said he was playing for the present and might use Soriano if necessary Wednesday.
The Sox got the potential go-ahead run in scoring position in the 11th, on a walk, fielder's choice and wild pitch. But Lowe struck out Ryan Lavarnway and intentionally walked Yankee-killer Pedro Ciriaco to bring up Jose Iglesias, who was hitting .109.
Iglesias hit a weak grounder to end the inning.
New York put the winning run on in the bottom of the 11th with a two-out single by Nick Swisher. But Alex Rodriguez's long drive to center was snared by center fielder Jacoby Ellsbury, who made a running, over-the-shoulder catch to end the inning.
The Red Sox, long removed from having much to play for, offered a lot more fight than they had in Monday's 10-2 loss.
Pedroia drove in a run with a double during a two-run first after sitting out Monday. Pedroia had reportedly been sent a text message by Orioles shortstop J.J. Hardy, asking him to play, and Baltimore had reportedly been upset with Boston's Monday lineup full of players who spent most of the season in the minors.
Boston first baseman James Loney hit just his second home run in 29 games, off Soriano, to give the Sox a 3-1 lead in the ninth.
Lester, who had lost three in a row and allowed 10 runs in 20 innings, gave up eight hits in five innings, but constantly wiggled out of trouble. He left after the fifth due to a back spasm.
The Yankees reached Lester for a run in the second on Nunez's RBI single to make it 2-1. But Lester twice escaped jams with one out and runners on the corners by getting Teixeira to ground into inning-ending double plays. Lester also got Teixeira to ground out with two outs and two on in the fifth.
Rookie right-hander David Phelps gave the Yankees 5 1/3 innings of two-run ball, allowing three hits and striking out four.
NOTES: Swisher moved back to the No. 2 spot in the order Tuesday after Ichiro Suzuki had been there in nine of the previous 10 games. Girardi said, with both players hot, he liked the switch-hitting Swisher up higher against the lefty. ... Top Yankees pitching prospect Manny Banuelos is scheduled to undergo Tommy John elbow ligament surgery, which likely would keep him from pitching next season. ... Right-hander Daisuke Matsuzaka will make what is likely to be his final start with the Red Sox in the season finale Wednesday. After winning 33 games in his first two seasons, the pending free agent has won just 17 the past four years, and he has gone 1-6 with a 7.68 ERA this season.