Sweden's coach, Pia Sundhage, gets a chance to defend the gold medals she won as coach of the United States in Beijing and London

Receive the latest national-international updates in your inbox

Hedvig Lindahl of Sweden embraces a teammate following the Women's Football Semi Final between Brazil and Sweden on Day 11 of the Rio 2016 Olympic Games at Maracana Stadium on August 16, 2016 in Rio de Janeiro, Brazil.

The roaring crowd at the Maracana Stadium desperately wanted Lisa Dahlkvist to miss.

It didn't bother her at all.

Dahlkvist just pretended all those Brazilians were cheering for Sweden, and then she stepped up and buried her penalty kick to eliminate the host country and send the Swedes to the Olympic soccer final.

"The noise was for me, to get the ball in the goal. Simple answer," Dahlkvist said, laughing while describing how she tuned out the din at the nearly full stadium.

Sweden advanced to the gold medal match in women's soccer for the first time by beating host Brazil 4-3 in a penalty shootout following a scoreless draw.

And it was the second time Dahlkvist had come through under pressure on penalties: Her kick ousted the favored U.S. women in the quarterfinals.

Brazil forward Marta, one of the biggest stars of the tournament, buried the first kick of the shootout. But at 3-3, Sweden goalkeeper Hedvig Lindahl stopped Andressa's shot before Dahlkvist beat Barbara to end it, stunning the packed home crowd.

Sweden, which has never before played in the gold match at the Olympics, will next face either Germany or Canada in the final on Friday at the Maracana, the site of the men's World Cup final in 2014. Brazil will play for the bronze in Sao Paulo against the loser of the other semifinal match.

Marta had one of Brazil's best chances to put her team in the lead, but her free kick in the 115th minute bounced before the goal and Lindahl was able to snag it.

The fans at the 78,000-seat Maracana — the biggest crowd ever for a women's national team match in Brazil — roared whenever Marta touched the ball. Brazil's charismatic forward won FIFA's Women's World Player of the Year five consecutive years from 2006-10. But she has never won a major international tournament with her national team.

"This loss won't take away from all that we have done to get here," Marta said. "We have the match for the bronze medal now and we will fight until the end to get that medal. We have to pick up the pieces to try to win this medal."

Both teams had their chances in the opening 90 minutes, and the intensity rose as the defensive-minded Swedes started going on the attack more.

Sweden was riding high after knocking off the three-time defending champion United States in the quarterfinals. The loss sent the top-ranked Americans home without a medal for the first time since women's soccer joined the Olympics in 1996. The World Cup champions were vying for their fourth straight gold.

Sweden deployed a defensive strategy against the United States and advanced 4-3 on a penalty shootout after a 1-1 draw in Brasilia. Afterward, U.S. goalkeeper Hope Solo drew attention for calling Sweden "a bunch of cowards" for its style of play.

Sweden coach Pia Sundhage used a similar tactic against Brazil, changing her approach after losing to Brazil 5-1 in group play. Marta and Beatriz scored two goals each in that first match.

The Brazilians have twice won silver medals at the Olympics. Both times, at the 2004 Athens and 2008 Beijing Games, the United States won in the final.

Sweden's best finish was in Athens when the team fell to Germany in the bronze medal match. Brazil beat Sweden 1-0 in the semifinals at those Olympics.

"Yes, we are very excited. That we are doing something that the Swedish national team has never done before — play for a medal — it's a big smile," Sundhage said. "Still, were not satisfied. We want to win the next game."