ST. PETERSBURG, Fla. - And then again, sometimes these things go exactly as expected.

Monday night brought together the two worst offenses in the American League, and, to the surprise of no one, scoring suffered.

So too, in some respects, did the 16,058 at Tropicana Field who paid to watch the Yankees and Rays flounder, flail and fail at the plate until Ben Zobrist's bases-loaded single off Shawn Kelley with two outs in the bottom of the ninth gave the Rays a walk-off 1-0 victory.

"We're just not hitting," Joe Girardi said, not for the first time this season. "It's frustrating. Eventually it has to turn, but it better turn pretty quickly here."

Even if it does, and there's no reason to think it will, the 2014 Yankees (76-73) are all but done.

It was the Yankees' ninth walk-off loss of the season and third in their last five games. Coupled with the Orioles' victory over the Blue Jays, it officially eliminated them from AL East contention. And it seems only a matter of days before they're eliminated from the wild-card race, too, as they sit six games behind the Royals with 13 to play.

"We're not in a good spot right now," Brett Gardner said. "It's just a shame because our pitchers have really stepped up the last couple months and done a good job and, as an offense, we haven't."

The Yankees have been shut out four times in 11 games and five times in 16, and they are 29-for-166 (.175) in the last five games. They have scored six runs (four solo homers, one RBI single, one steal of home) in their last 47 innings and have scored more than one run in only one of those innings.

"For one reason or another, as a team, we haven't really come together and put a lot of runs up consistently," Gardner said. "As well as we've pitched, we didn't need to be great, we just needed to be good, and we haven't been."

For months, that's had the pitching staff feeling as if it needs to be perfect, and Kelley was not. The Rays put together three hits in the ninth against him, one more than they had in the first eight innings against Chris Capuano and Adam Warren.

With one out in the ninth, Logan Forsythe and James Loney singled. David DeJesus struck out, but Matt Joyce walked and Zobrist lined a single to right to win it.

"I have to go out and put up a zero," Kelley said, refusing to blame the offense. "Whether it's 0-0 or 10-0."

Entering Monday, the Yankees ranked last in the AL in runs with 577, with the Rays hot on their heels with 578.

The clubs honored those forlorn numbers much of the night, with the primary beneficiaries the starting pitchers.

Capuano allowed two hits in six innings. His counterpart, righthander Alex Colome, recalled earlier in the day to make his fifth career start, allowed six hits in 62/3 innings.

Fans were momentarily awakened with one out in the seventh when Chase Headley took a called strike that made it 0-and-1. He did not like Marty Foster's call and, after a brief back-and-forth, was ejected for the third time in his career.

"I don't understand that," Girardi said. "We're competitors, we're fighting. I disagree with it. I just think that there's a better way to handle it. The umpires obviously don't have a stake in the outcome, but we do, and I think that needs to be better understood, especially in the month of September."

Headley thought Foster, who has a short-fuse reputation, escalated the confrontation.

"I didn't think what I said warranted an ejection, especially with the way I felt he responded to me," Headley said. "There's a right way and a wrong way to respond, and I didn't think anything I said to him was over the line. It was pretty quick. I didn't think what I said typically gets you thrown out of a game."