New York Yankees Mark Teixeira, left, celebrates with Alex Rodriguez...

New York Yankees Mark Teixeira, left, celebrates with Alex Rodriguez after scoring on Rodriguez's seventh-inning two-run, home run off Boston Red Sox starter Daisuke Matsuzaka in their baseball game at Yankee Stadium in New York, Sunday, Sept. 26, 2010. Credit: AP

An entire organization and fan base exhaled at 11:59 last night.

That's when Juan Miranda drew a bases-loaded walk in the bottom of the 10th inning against Hideki Okajima to give the Yankees a 4-3 win over the Red Sox at Yankee Stadium.

The Yankees snapped a four-game losing streak and dropped their magic number to clinch a playoff berth to one.

Earlier, the game featured a dramatic home run by Alex Rodriguez, a blown save by Mariano Rivera as the Red Sox rallied for two runs in the top of the ninth, a blown save by Jonathan Papelbon as the Yankees rallied to tie it in the bottom of the ninth, and three lead changes in the final four innings.

Curtis Granderson started the 10th with a single off Okajima. Brett Gardner, attempting to sacrifice, dropped a bunt in front of the plate. Catcher Victor Martinez hit Gardner with his throw, sending Granderson to third.

After an intentional walk to Derek Jeter, pinch hitter Marcus Thames grounded a hard shot to third, and Adrian Beltre got a forceout at the plate. The lefthanded-hitting Miranda, who entered in the top of the 10th, was allowed to bat against the lefthanded Okajima. He walked on a 3-and-1 pitch to drive in Gardner with the winning run.

"I was ready to swing,'' Miranda said through Robinson Cano. "Everybody dreams about coming up a getting a chance in a big situation like that."

All the Yankees have to do is win one of their final six games to earn a berth in the postseason. They will make it if Boston loses one of its final seven games.

"I think I'll sleep once I get to Toronto,'' Joe Girardi said. "It is a good feeling in the clubhouse. It really is."

Said Rodriguez, "There's no question, this was a huge win. There's no ifs, ands or buts about it. It was an enormous win for us, especially the last home game for a bit now. I think it would have been devastating to lose a game at home."

The Yankees moved to within a half-game of the first-place Rays. Tampa Bay, which has seven games left, holds the tiebreaker for the division crown.

The Yankees took a 2-1 lead in the seventh on Rodriguez's two-run home run to right-centerfield on an 0-and-2 pitch from Daisuke Matsuzaka - his 29th homer of the season and 612th of his career.

But helped by four stolen bases in the ninth, the Red Sox scored two runs off Rivera - who was attempting a four-out save - and took a 3-2 lead to the bottom of the ninth.

Boston's Ryan Kalish singled with one out and stole second and third before scoring on Bill Hall's single. Hall stole second and third before scoring the go-ahead run on Mike Lowell's sacrifice fly. " part of the game,'' Rivera said. "We won the game. That's what matters."

The Yankees sent the game into extra innings on Cano's bases-loaded single off Papelbon. With the bases still loaded and one out, they had a chance to win right there, but Papelbon struck out Jorge Posada and got Lance Berkman to fly to right.

More Yankees headlines