The Women’s World Cup quarterfinal between the United States and Brazil on Sunday took enough twists and turns to fill an entire tournament. If an early own goal, a controversial ejection and a retaken penalty kick weren’t enough, there was a go-ahead strike in extra time by Marta, the Brazilian superstar, and a last-ditch equalizer by Abby Wambach, the Americans’ bruising forward.

One last act of spellbinding theater awaited — and Hope Solo and Ali Krieger embraced the spotlight at Rudolf-Harbig Stadium.

Solo made a diving save in the third round of a penalty kick tiebreaker and Krieger, a Dumfries native, capped a flawless performance by the Americans in the shootout by tucking her attempt into the lower left corner for a 5-3 advantage and the win. That followed a 2-2 draw through 120 minutes of regulation and overtime.

The victory avenged a 4-0 loss to Brazil in the 2007 Women’s World Cup semifinals in China and came exactly 12 years after the United States prevailed in a tiebreaker against China to win the championship.

With their latest triumph, the Americans advanced to face France, a first-time semifinalist, on Wednesday in Moenchengladbach.

The other semifinal, scheduled for the same day in Frankfurt, pits Japan, which ousted two-time defending champion Germany on Saturday, against Sweden, a 3-1 winner over Australia earlier Sunday.

The Americans haven’t won the world title since 1999 and appeared in jeopardy of falling short again by finishing second in group play behind Sweden and falling behind previously unbeaten Brazil in the extra period.

“I’m at a loss and I literally cannot believe what just happened,” Wambach said. “But we’ve got two games left.

“The history of the team has always been we never give up,” she added.

The Americans went ahead 74 seconds into the match on an own goal — the first blemish against Brazil in the 16-team tournament. Shannon Boxx crossed the ball to the six-yard box, where Brazilian defender Daiane deflected it into her own net.

But midway through the second half, Brazil pulled even on a chaotic sequence. Australian referee Jacqui Melksham red-carded U.S. defender Rachel Buehler for taking down Marta in the box. That resulted in a penalty kick and left the Americans short-handed for the remainder of the match.

Solo stopped Cristiane’s attempt, but while the goalkeeper celebrated with teammates, Melksham ordered the kick taken again.

At the time, it was assumed that Melksham ruled Solo had stepped forward before the ball was struck — a violation — but TV replays showed a U.S. player entering the penalty area too early.

Marta took the second attempt and converted easily, tying the score at 1.

A five-time FIFA player of the year, Marta struck again two minutes into extra time, lifting the ball over Solo from a difficult angle. While the play was unfolding, Boxx turned for an instant to plead for an offside call. Marta gained just enough separation to connect with the cross and put Brazil ahead.

“Sometimes we play better when we’re down,” Solo said. “We never like things easy.”

For the rest of overtime, the Americans pressed valiantly, keeping the ball in Brazilian territory for much of the time. Three minutes of added time tacked to the end gave them their chance.

Midfielder Megan Rapinoe crossed toward Wambach, who beat a defender and goalkeeper to the high ball and headed it into the net, inspiring thunderous cheers from the sold-out crowd of 25,598.

In the shootout, in which teams alternate attempts, Boxx, Carli Lloyd and Wambach converted for the United States and Cristiane and Marta scored for Brazil before Solo leapt fully extended to her right to block Daiane’s shot.

After Rapinoe and Francielle exchanged goals, Krieger clinched the victory.

“I just blocked everything out and focused on making the shot,” said Krieger, 26, who starred in the Prince William youth programs and at Forest Park High before playing at Penn State. She has spent most of her professional career in Germany.

“There’s something about the American attitude” that kept the team going even when the match appeared lost, U.S. Coach Pia Sundhage said. “Right now, I’m the happiest person on Earth.”

Staff writer Steven Goff contributed to this report from Washington.

Sweden advances to semis

In Augsburg, Lotta Schelin scored one goal and set up another as Sweden beat Australia, 3-1, to reach the semifinals.

After setting up Therese Sjogran for the opening goal in the 11th minute, Schelin pushed the lead to 3-1 in the 52nd to set off the players’ traditional Swedish dancing celebrations.

Schelin capitalized on a poor back pass from Kim Carroll and took one touch past goalkeeper Melissa Barbieri before slotting the ball into the unguarded net.

“There is a fantastic atmosphere in our team and we pulled each other through,” said Schelin, the player of the game.

The result means Sweden also qualifies for the London Olympics next year.

Sjogran set up Lisa Dahlkvist for Sweden’s second goal in the 16th in front of 24,605 fans, before Ellyse Perry briefly gave Australia hope with a stunning effort in the 40th.

Japan upset host Germany in another quarterfinal and will play Sweden on Wednesday.

— Associated Press