The three-time defending Olympic champion U.S. women's soccer team was knocked out by Sweden in Friday's quarterfinal, losing a penalty shootout 4-3 after a 1-1 draw.
Alex Morgan had the first U.S. penalty saved by Swedish goalkeeper Hedvig Lindahl and Christen Press sent her kick high over the crossbar in round five.
U.S. keeper Hope Solo changed her gloves in an effort to freeze Lisa Dahlkvist, but to no avail as Dahlkvist sent the winning penalty past Solo and into the net.
As Sweden celebrated, U.S. captain Carli Lloyd crouched on the field at Mane Garrincha Stadium in Brasilia. It was the first time that an Olympic women's match had gone to penalties.
The United States had played in the final every year since women's soccer became an Olympic sport in 1996, winning gold four times. Their only silver medal came in 2000, when Norway took gold.
After a scoreless first half, Stina Blackstenius scored in the 61st minute to give Sweden a 1-0 lead.
Morgan scored the equalizer in the 78th and the match went to extra time. Lloyd had a header called back for offside in the 115th minute, and Lotta Schelin was offside on her attempt against Solo a minute later -- although replays appeared to show otherwise.
The U.S. women, who are also reigning World Cup champions, had not dropped a match this year. But it is Sweden that will play either Australia or host Brazil in the semifinals.
Blackstenius, who came in as a substitute in the first half, broke away and shook off defender Julie Johnston to beat Solo and give Sweden the lead. It was just her second international goal.
Sweden's coach, Pia Sundhage, high-fived her assistants on the bench. Sundhage coached the U.S. team for five years and led the squad to gold medals in both Beijing and London.
The United States got the equalizer with Morgan's shot that bounced off a Sweden defender. It was Morgan's team-leading 13th goal of the year. Lloyd nearly put the United States ahead in the 85th but her kick to the far corner went just wide.
The Americans won their first two matches in Brazil before a surprising 2-2 draw in Manaus against Colombia, which had already been eliminated.
Johnston returned to the starting lineup after missing the last two games with a groin injury and coach Jill Ellis played all her regular starters after rotating and resting many against Colombia in the heat and humidity of the Amazon. Megan Rapinoe, who started against Colombia after missing more than eight months after right knee surgery, was on the bench but came on as a substitute in the second half.
Press replaced Rapinoe in the extra period.
Sweden had won only five matches against the United States. The two teams played to a scoreless draw at last year's World Cup. The last time the two teams met in the Olympics was at the 1996 Atlanta Games. Sundhage was a player on the Sweden team that fell 2-1 to the Americans.
Ranked sixth in the world, Sweden had struggled in its Olympic group with a 5-1 loss to host Brazil and finished 1-1-1.
The crowd at Mane Garrincha Stadium in was sparse at the start of the match and never extended much past the lower bowl of the massive 72,000-seat stadium that was reconstructed and expanded for the men's 2014 World Cup.
The fans that were there continued to jeer Solo with shouts of "Zika!" everytime she touched the ball. The fans have taunted her since the opening match in Brazil because of her posts on social media about the virus.
The Associated Press contributed to this report.