The goal for Japan was to do more than just win, but to win big if there was to be a chance of making the second round.
Japan will have to settle for the win.
Trailing 2-1, the Japanese brought a frenzied crowd of 17,224 to its feet with one of the more memorable comebacks in Olympic soccer history.
Japan twice came from behind and scored two goals in the 90th minute to stun Hungary 3-2 at the Florida Citrus Bowl Thursday night.
The win, however, was not enough to push Japan past Group D opponents Nigeria and Brazil, which qualified ahead of Japan based on goal difference.
The miraculous turnaround began when Japan brought on substitute Kenichi Uemura for the final minute of play. Uemura immediately ran to the box and headed a cross from captain Masakiyo Maezono into the net to tie the score 2-2.
Japan quickly regained possession after the kickoff and with the clock still reading 90-minutes, Teruyoshi Ito raced down the right wing and crossed to Maezono, who drove the ball into the net for the lead.
ITALY 2, SOUTH KOREA 1: Marco Branca scored two goals, including the tiebreaker with seven minutes to go in Birmingham, Ala., as Italy knocked South Korea out.
GHANA 1, MEXICO 1: Pavel Pardo deflected a ball into his net for an own goal that nearly eliminated the Mexicans, then redeemed himself by supplying a picture-perfect assist on the tying score by Jose Abundis in Washington. Ghana advanced ahead of South Korea on the third tiebreaker, more goals scored.
BRAZIL 1, NIGERIA 0: Ronaldinho scored the only goal on a low line-drive kick just inside the right goalpost, all the time fighting off a Nigerian with his right arm as he fired in Miami. Brazil will play Ghana on Sunday in Miami. Nigeria takes on Mexico at Birmingham.
_ Information from Times wires was used in this report.