Raul Ibanez had a pinch-hit, two-run line drive homer in the bottom of the ninth to tie it, then delivered a walk-off RBI single in the 12th as the Yankees rallied for a 4-3 win over the Red Sox, maintaining a one-game lead with one to play.

Just as it looked like Boston would help Baltimore retake a share of the division lead, Andrew Bailey allowed the tying runs to score, his third blown save.

Starter David Phelps allowed two of the Red Sox's runs on three hits and two walks through 5 1/3 innings.

Boston countered with Jon Lester who gave up just one unearned run on eight hits in five innings.

Dustin Pedroia had an RBI double in Boston's two-run first inning, while James Loney added a solo-blast in the top of the ninth.

The Yankees need a win or a Baltimore loss on Wednesday to wrap up the AL East, but if the Yanks lose and the O's win, they'll duke it out for a one game playoff on Thursday with the loser taking a wild-card position.