The Yankees were shooting themselves in the foot all night when they had opportunities with runners in scoring position.

And then Raul Ibanez came into the game and changed that with two at-bats.

The Yankees had an early opportunity to cut into Boston’s 2-0 lead, with runners on first and third and one out in the first inning.

Mark Teixeira weakly grounded into a double play to end the threat.

The Yankees were able to get on the board in the bottom of the second when Eduardo Nunez ripped the ball towards Jose Iglesias, who couldn’t field it cleanly, and Curtis Granderson scored to make it 2-1, Boston.

In the bottom of the third, with runners on first and third again, Teixeira again bounced into another double play to end another possible scoring inning.

In the bottom of the sixth inning, with runners on second and third and two out, Ichiro Suzuki hit a hard liner to center field to end the inning.

In the top of the ninth, Red Sox first baseman, James Loney, gave Boston an insurance run by hitting a solo home run off Yankees closer Rafael Soriano to make it 3-1.

In the bottom of the ninth, the Yankees’ luck with runners on base changed.

Granderson started off the inning by singling off Boston closer Andrew Bailey, which lead to Ibanez coming up in a pinch-hit situation for Eduardo Nunez.

Ibanez cranks out a two-run, game-tying home run in the bottom of the ninth to make it 3-3.

Bailey loaded the bases with only one out, and Teixeira had a chance to redeem himself for the awful night at the plate.

Unfortunately, Teixeira’s poor performance at the plate continued as he hit a weak fly ball to Jacoby Ellsbury in center field and it wasn’t deep enough to score the winning run at third. Robinson Cano hit a grounder to second base to end the inning and the scoring threat.

The bullpens continued to battle as Mark Melancon and Vicente Padilla pitched well for Boston while Derek Lowe gave the Yankees two solid innings.

In the bottom of the twelve inning with two outs, Francisco Cervelli was able to draw a walk on lefty Andrew Miller.

Granderson also walked to set up first and second with two outs, which again lead to Ibanez coming up in a big spot.

Ibanez then got a base hit past the shortstop and third baseman, allowing Cervelli to come around to score and win the game for the Yankees 4-3.

Lowe got the win for the Yankees (9-11) while Miller took the loss for Boston.

Because the Orioles defeated the Rays 1-0 on Tuesday night, the Yankees didn’t clinch the A.L. East, but all they have to do is win on Wednesday night and they will lock up the division.

In the 2012 regular season finale, it will be the battle of Japanese pitchers as Hiroki Kuroda looks to lock up the division for the Yankees, while Boston will counter with Daisuke Matsuzaka.

All year long, we’ve talked about the Yankees’ inability to hit with runners in scoring position, and it’s a reason why the Yankees had to play Boston until the 12th inning.

But Ibanez was able to step in and give the Yankees clutch hits when they needed it most, and hopefully it’s a trend that he can continue in October.

Given how the final month of the season has played out, it’s only fitting that the Yankees have to attempt to win the division on the final day of the season.

Many Yankee fans will be looking for the Bombers to wrap up the division on Wednesday night. I think they will get it done because they don’t want to end up tied with Baltimore and have to go to Camden Yards for a one-game playoff.

Despite a rough night hitting in key situations, the Yankees can feel good knowing they control their own destiny for the postseason.

Stay tuned, Yankees Universe.

Read more MLB news on BleacherReport.com