Ibanez had forced extra innings when he lined a two-run homer off Bosox closer Andrew Bailey with none out in the bottom of the ninth, forging a 3-3 tie.
Then in the 12th, Francisco Cervelli and Curtis Granderson drew a two-out walks from Andrew Miller (3-2) and Ibanez followed by bouncing a pitch through the hole and into left field for the decisive hit.
Derek Lowe (9-11) tossed two scoreless innings to earn the win for the Yankees, who retained their one-game lead in the American League East with one regular-season game remaining.
Second-place Baltimore Orioles had edged Tampa Bay 1-0 earlier Tuesday.
Boston schools pull out free condoms over wrapping complaints
Ray Liotta sues skin care company over use of likeness