The United States and Brazil will meet in the final of the Olympic women's football after claiming contrasting wins in Tuesday's last-four ties against Germany and World Cup holders Spain respectively.
The USA, record four-time women's football gold medallists, are still on course to win the title for the first time since 2012 after beating Germany 1-0 in extra time in Lyon, with Sophia Smith scoring the only goal.
Brazil later won through to their first final since 2008 by unexpectedly getting the better of the reigning world champions with a remarkable 4-2 victory in Marseille.
The USA, under new English coach Emma Hayes, will be favourites to win Saturday's final showdown at the Parc des Princes in Paris and claim a record-extending fifth title after previous triumphs in 1996, 2004, 2008 and in London 12 years ago.
However, they had to toil against Germany on a stiflingly hot day before eventually winning with a single extra-time goal, just as they had in the quarter-final against Japan.
Smith, who scored twice in a 4-1 win over the same opponents in the group stage, struck five minutes into extra time, firing past Germany goalkeeper Ann-Katrin Berger after being played in by Mallory Swanson.
Smith then missed chances to put the tie to bed, while the USA were grateful in the end to goalkeeper Alyssa Naeher for a crucial late save to keep out Laura Freigang's header at point-blank range.
"It means everything," Smith said when asked to sum up reaching the final a year after a poor showing at the World Cup.
"We had a tough year last year, in every way possible, but I feel like this is a new year and we are really just showing the world that we didn't ever drop off.
"We just needed a learning year and a growth year and we are back and hopefully on top after this next game. This team is so special."
The USA are guaranteed at least silver after finishing out of the medals at Rio 2016 and taking bronze three years ago in Tokyo.
It is a remarkable achievement for new English coach Hayes, who only left Chelsea to take up the job a little over two months ago.
"There were lots of things I didn't like in the game. I tried every situation to try to influence and affect that, but it's not about that. It's about heart and head," Hayes said.
"You have to dig something out. Our group want to create new history for themselves. They did enough to get us in the final, and that is just the next step."
Spain were favourites to beat Brazil in Marseille and join the USA in the final, especially having already defeated the South Americans in the group stage.
However, there were signs of fragility in the last eight, when they came from two goals down against Colombia before eventually winning on penalties.
This time a Brazil side missing suspended captain Marta came out on top, and it is they who go through to the final.
An early Irene Paredes own goal put Brazil in front, and Gabi Portilho doubled their lead in first-half stoppage time.
Adriana made it 3-0 in the second half before a frantic finish saw Spain pull goals back via a Duda Sampaio own goal and a Salma Paralluelo effort, while Kerolin got Brazil's fourth.
Brazil will now at worst match their previous best showing in the Olympic women's football, when they won the silver medal in 2004 and 2008, losing the final on both occasions to the USA in extra time.
Spain, meanwhile, can still claim a first ever medal when they play Germany in Lyon on Friday in a play-off for bronze.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ