Jesus Rollan made spectacular saves to stop nearly everything the United States threw at him. On the rare occasions when he was beaten, either the bar or the post usually got in the Americans' way.
The result was a 5-4 victory Friday that sent Spain to a semifinal clash with Hungary and cost the Americans any hope of a medal.
The best the United States can achieve is fifth place, a deep disappointment for coach Rich Corso and his team after three years of training. The Americans finished fourth in Barcelona.
"We created great opportunities, but we didn't finish them," said Corso, who is retiring as coach after the Olympics. Of his players, he said, "They are devastated."
The final score was misleading as three of the American goals came in the second half of the final quarter. Rollan made 11 saves and 35-year-old captain Manuel Estiarte scored two goals.
"He is a great goalie, but we also hit everything but the net," Corso said. "We hit a lot of bars."
U.S. captain Chris Humbert was ejected at the end of the third period. Angry because Dutch referee Robert Tellegen didn't call a foul, Humbert splashed some water in the direction of the referee.
In other action, Croatia won its first Olympic showdown with Yugoslavia, 8-6, to reach the semifinals.
"This victory means more than winning a medal," said Dubravko Simenc, whose long-range shooting produced three goals for Croatia.
Hungary, a six-time gold medalist seeking its first Olympic title since 1976, cruised to a 12-8 victory over Greece.