Hosts Brazil were agonisingly denied a place in the final of the women's football tournament at Rio 2016, courtesy of a penalty shoot-out defeat to Sweden.
Despite being on the front foot for the vast majority of Tuesday's match at the Maracana, Brazil were unable to break the deadlock against a team they beat 5-1 in the group stage.
After 120 minutes of goalless action, Sweden ran out 4-3 winners on penalties. Pia Sundhage's team will now face Germany, 2-0 winners over Canada, in Friday's final.
Silver medallists at the 2004 and 2008 Olympics, Brazil had high hopes of going one better on home soil, particularly after Sweden eliminated two-time reigning champions the United States in the last eight.
That win also came in a shoot-out, the approach of Sundhage's side bringing condemnation from USA goalkeeper Hope Solo, who branded Sweden "a bunch of cowards".
Sweden were again content to sit deep and get bodies behind the ball on Tuesday and their defensive solidity was ultimately rewarded.
Cristiane of Brazil and Sweden's Kosovare Asllani saw penalties saved in the shoot-out, before the fifth round of kicks proved decisive.
Hedvig Lindahl dived to her right to deny Andressa Alves, meaning Lisa Dahlkvist's subsequent conversion was enough to knock Brazil out.
A penalty put Germany on course for victory the day's second semi, Melanie Behringer powering home from 12 yards in the 21st minute after Kadeisha Buchanan had been penalised for a foul on Alexandra Popp.
Sara Dabritz doubled Germany's lead just before the hour mark, taking a touch with her left foot before firing home a low right-footed shot from the edge of the box.