Canada secured a 1-0 victory over world champions the United States to set up a women's Olympic football final against Sweden at Tokyo 2020.
Jessie Fleming scored Canada's winner from the penalty spot after Deanne Rose was fouled by Tierna Davidson inside the box at the Kashima Stadium.
Canada will face Sweden in Friday's gold-medal match.
Fridolina Rolfo scored the only goal as Sweden beat Australia to reach their second successive Olympic final.
Having been favourites to win the tournament, Vlatko Andonovski's US side will compete for bronze on Thursday against Australia, when the Matildas will play in an Olympic women's football medal match for the first time.
After reaching the final of every women's Olympic football event since its introduction in 1996, the US have now failed to reach the final in successive Games.
Beverly Priestman's Canada are guaranteed at least silver in Tokyo, meaning midfielder Quinn will be the first openly transgender athlete to win an Olympic medal. Canada and Quinn won bronze in Rio 2016 before Quinn came out in September 2020.
Canada scored with their only shot on target to beat their neighbours for the first time since March 2001.
Davidson's foul on substitute Rose was initially missed by referee Kateryna Monzul, but the Ukrainian pointed to the spot after the video assistant referee (VAR) showed the Canadian was kicked as they both challenged for a loose ball.
Substitute goalkeeper Adrianna Franch guessed the right way, but Fleming found the bottom corner for the 75th-minute winner.
Franch had replaced US first-choice Alyssa Naeher in just the 30th minute after the hero of their quarter-final penalty shootout win over the Netherlands had landed awkwardly following a challenge by Nichelle Prince.
The US dominated possession in the second half and had six shots on target, but could not find a way past goalkeeper Stephanie Labbe.
"It sucks. We just didn't have it today," said US forward Megan Rapinoe.
"Just too many errors from us again. Obviously we never want to lose to Canada, I don't think I've ever lost to Canada. So it's a bitter one.
"I've been thinking about the whole tournament and we just didn't have that juice that we normally do."
Sweden into final for second straight Games
After hitting the crossbar with Sweden's best chance of the first half, Rolfo gave the Rio 2016 runners-up the lead within minutes of the restart of their semi-final.
Australia goalkeeper Teagan Micah tipped a deflected long-range shot onto her crossbar, but the Matildas defence could not clear and Barcelona forward Rolfo volleyed in the rebound from a tight angle.
Alanna Kennedy came closest for Australia in the first half when her free-kick dipped over the wall, but goalkeeper Hedvig Lindahl reacted quickly to tip the ball over.
Ellie Carpenter was sent off in injury time as she hauled down Lina Hurtig seconds before the final whistle.
- The man who introduced Joe Wicks to meditation: Exploring spirituality and mindfulness with Russell Brand
- The Ancient Olympics: You're Dead To Me explores how even death couldn't stop you winning