NEW YORK (AP) -- Trailing by four runs in the 13th inning, Raul Ibanez and the New York Yankees were far from finished.
They were just getting started.
Ibanez hit his second home run of the game during a startling rally in the 13th, then the Yankees won a thriller when first baseman Brandon Moss' two-out error in the 14th lifted them over the Oakland Athletics 10-9 Saturday for their seventh straight win.
''I told you all along that I like the fight in this team,'' Yankees manager Joe Girardi said. ''Some of the things we go through, we find ways to get back up.''
The AL East leaders came back to hold their one-game edge over Baltimore with a second straight extra-inning win against the A's.
Down 9-5 in the 13th, the Yankees won for just the second time in team history after trailing by at least four runs in extra innings, according to STATS LLC. They also did it in September 1980 against the Blue Jays.
''Right now every game is magnified, and we know the situation,'' Ibanez said. ''It's a lot of fun.''
Oakland began the day with a 3 1-2 game lead over Los Angeles for the second AL wild-card spot. The A's still have an edge, but blew a huge opportunity and lost for the fifth time in six games.
This was the first time in franchise history the A's lost after leading by four runs in extra innings, according to information provided to the Yankees by the Elias Sports Bureau.
''We fought pretty hard, really hard,'' A's manager Bob Melvin said. ''I never remember a game quite like that that I've ever been a part of.''
Moments after pinch runner Melky Mesa - in his big league debut - missed third base and had to retreat, the Yankees found another way to win. Moss let a bases-loaded grounder by Eduardo Nunez skip off his glove, allowing Ichiro Suzuki score and ending a game that took 5 hours, 43 minutes.
Nunez threw his hands in the air as he raced to first base as Tyson Ross (2-10) walked off the field, head down he shouted into his glove. Suzkui embraced Ibanez near home plate as most of the team ran to first base to mob Nunez, who eventually found Mesa and put his arm around him. Both were smiling.
''I'll give him credit. He didn't compound the problem by continuing to go. He went back to third base,'' Girardi said. ''I'm sure everyone would've seen it and he would've been called out and that would've been the inning.''
Girardi paid Mesa a visit in the clubhouse afterward.
''It's a bad mistake,'' Mesa said. ''I can do nothing about it but wait until the next time and fix it.''
Johnny Gomes, Yoenis Cespedes and Chris Carter homered in the 13th, putting the A's ahead. New York rallied in the bottom half, scoring runs on a wild pitch and Nunez's sacrifice fly before Ibanez hit a tying, two-run drive off Pat Neshek.
In a game that included a bruising hit at home plate, stellar defensive plays and even a bit of rain, the Yankees got a bit of luck to outlast the A's.
Eric Chavez led off the 14th with a single against Ross and Mesa pinch ran. Derek Jeter sacrificed and Suzuki was walked intentionally, bringing up Alex Rodriguez.
Rodriguez singled to center, and the Yankees erupted in the dugout, sensing they had won. But Mesa stepped over third base, had to retrace a few steps and was held up.
Robinson Cano followed with a bouncer between the mound and first base. Ross lunged for the ball, spun and threw home for a forceout.
That left it up to Nunez, and he sliced a grounder toward first base. Moss slid over and was in position to make the play, but the ball bounced off his mitt and skittered away for Oakland's third error of the game.
''We should have come out with a win,'' A's catcher Derek Norris said. ''We fought back, they fought back harder.''
Cory Wade (1-1) pitched the 14th for the win.
Seldom-used Yankees first baseman Steve Pearce made a diving catch of a vicious line drive with the bases loaded to end the 11th inning. Norris withstood a violent collision with Ibanez and held onto the ball in the 12th.
''That's what we come to expect from Raul. That's what he does. He plays extremely hard,'' Girardi said. ''Sometimes we forget he's 40 years old, the way he plays the game.''
All in all, it was quite a contrast to their game Friday night, when Russell Martin's solo homer in the bottom of the ninth sent the Yankees over the A's 2-1.
Gomes hit a two-run homer in the 13th that put the A's ahead. Cespedes and Carter also connected, but New York came back against an Oakland bullpen that had allowed just one run in 10 previous innings.
Ibanez had a pinch-hit homer in the fifth, ending his 0-for-18 skid and giving the Yankees a 5-4 lead but Carter tied it with a sacrifice fly in the seventh.
NOTES: MLB made a scoring change that took a double away from Cano on Sept. 15 against Tampa Bay. Rays CF B.J. Upton will be charged with an error on Cano's ball in the eighth inning. ... A's OF Coco Crisp was out again with an eye allergy. Manager Bob Melvin says he is close but is not sure if Crisp will play this weekend. ... New York 1B Mark Teixeira (calf strain) took ground balls, did light jogging and took batting practice and will fly to Tampa, Fla., on Sunday to work out at the Yankees' complex. ... Jeter extended his hitting streak to a season-high 16 with a single in the sixth.