Bronx, NY (Sports Network) - It took until the next-to-last day of the regular season, but the New York Yankees finally won a game in which they trailed after eight innings.

Raul Ibanez was the hero for New York, belting a pinch-hit, game-tying two-run homer in the bottom of the ninth inning and later driving in the deciding run with a single in the 12th as the Yankees rallied for a 4-3 victory over the Boston Red Sox and moved closer to capturing the American League East title.

New York, which entered the night 0-58 when down heading into the ninth inning, won for the third time in a row and maintained a one-game edge on Baltimore for first place heading into Wednesday's final slate of games. Either a Yankees' win in the finale or an Orioles' loss to Tampa Bay would give the Bronx Bombers the division crown.

Onetime Red Sox hurler Derek Lowe (9-11) tossed two scoreless innings of relief to earn the win for New York, which prevailed despite stranding 14 runners on base. The Yankees outhit Boston by a 16-8 margin for the night.

Dustin Pedroia, playing with a recently fractured finger, went 2-for-5 with an RBI double in Boston's seventh straight defeat and 11th setback in 12 games. James Loney had a solo homer in the loss.

Ibanez's homer came with one out off Red Sox closer Andrew Bailey, who failed to protect a 3-1 lead in the ninth, while Andrew Miller (3-2) served up his game-sealing single.

Jon Lester limited the Yankees to one unearned run while scattering eight hits over the first five innings in his final 2012 start. David Phelps, replacing a struggling Ivan Nova in the New York rotation, allowed two runs and three hits in 5 2/3 innings of work.