The Oakland Athletics had just lost two in a row, including an extra innings epic, and were trying all they could to avoid a sweep against the New York Yankees on Sunday.

Then in the bottom of the ninth, with a 5-4 lead, A's closer Grant Balfour watched as Alex Rodriguez hit a long fly ball to the outfield. The Yankees were only feet away from tying the game, but Rodriguez's fly ball fell into Josh Reddick's glove at wall on the warning track to end the game.

"The way things went for us in this series, you never know," Balfour told the Associated Press.

The win came one day after a 14-inning game that saw the A's take a 9-5 lead in the 13th, only to give it back and later lose the game. Raul Ibanez tied the game for the Yankees with a home run in the bottom of the 13th, and then shortstop Eduardo Nunez hit a ground ball to first base that Brandon Moss couldn't handle that scored the winning run.

"To lose two games in extra innings is tough, especially when these games mean so much," Pennington said. "It was really still just another game, but it was a big one."

The Yankees had won seven games in a row, but were still only one game ahead of the Baltimore Orioles in the American League East. The Orioles also lost on Sunday, leaving the Yankees up by one game in the division.

With the win the Athletics kept a 2 ½ game lead over the Los Angeles Angels in the wild-card race.

The Athletics' took the lead in the sixth inning after an error by Nunez allowed Cliff Pennington to score. Nunez had two errors in the game and the Yankees as a team were sloppy, with three errors on the day. Earlier in the season Nunez was demoted to the minor leagues due to his fielding issues.

"I have to keep practicing defense. I have to keep working," Nunez said. "Tomorrow's a different day."

Oakland got out to an early 3-0 lead after a run in the first and a two-run home run by Pennington in the second, but the Yankees came right back in the fourth.

"Rarely do you lose a game like you did last night, and I think coming back from something like that and scoring early in the game showed some fight right away," A's manager Bob Melvin said. "It was a big game."

Nick Swisher hit a two-run home run and the Yankees added two more runs in the fourth off of a Raul Ibanez double and a Nunez grounder to take a 4-3 lead. But that was all they would be able to get the rest of the way.

The A's tied the game on a Yoenis Cespedes single and then want ahead later on Pennington's hit.

The Oakland bullpen was strong following starter AJ Griffin, who gave up seven hits and four runs. The relievers combined for 4.2 scoreless innings and Balfour was able to close the game for his 20th save.

"Terrific," Melvin said. "Our bullpen came up huge for us today."

Hiroki Kuroda was less than stellar for the Yankees, giving up five runs in five innings on seven hits. The Yankee bullpen allowed no runs, but the team couldn't find a way to tie the game.

The Yankees have 10 games left on the season, all against opponents under .500. On the other side, the Athletics have to face division-leading Texas for a four-game series starting on Monday and then for a three-game set to finish the year. They will also play three against the Seattle Mariners.

"We control what happens," Derek Jeter said. "We play how we're capable of, we win our games. We really don't have to look at the scoreboard."

Ichiro Suzuki added another hit for the Yankees and is hitting .517 with 15 hits and eight runs over the past seven days.

The Yankees will open a three game series against the Minnesota Twins on Monday.