(Atsushi Tomura/Getty Images)

The USWNT defeated Australia 4-3 on Thursday to capture the bronze medal in Tokyo.

The matchup, punctuated by seven goals, was a dramatic reversal from the teams’ scoreless draw during group play.

Megan Rapinoe opened up the scoring in the 8th minute for the USWNT with an Olimpico, curling in a dagger from the corner flag for the go-ahead goal.

Sam Kerr responded in the 17th minute, slotting a low shot past Adrianna Franch (who replaced injured starting goalkeeper Alyssa Naeher) to draw even. The first-half goal was Kerr’s 48th with Australia, making her the Matildas’ all-time leading goal scorer.

Less than five minutes later, Rapinoe struck again, volleying in a failed clearance to give the U.S. a 2-1 lead.

Carli Lloyd added to the USWNT’s tally just before the half, banging in a rocket from the top of the box to make it 3-1 at the break.

Lloyd got onto the scoresheet again in the 51st minute, beating the Australian goalkeeper to extend the USWNT’s lead to 4-1. With her second-half goal, Lloyd reached 10 in USWNT Olympic history, passing Abby Wambach for the most all-time.

Keeping the pressure up, the Matildas responded in the 54th minute with a header from Caitlin Foord to put the game at 4-2.

Emily Gielnik kept Australia’s hopes alive with a screamer from outside the box in the 90th minute. At 4-3 with stoppage time left to play, the Matildas were within striking distance.

The late-game push ultimately wasn’t enough to put Australia on the podium, and the USWNT walked away with a narrow victory.

The USWNT will leave Tokyo with a bronze medal, closing out a rocky Olympic Games on a high note. It is the USWNT’s sixth Olympic medal and first since 2012, after the team lost to Sweden in the quarterfinals of the 2016 Rio games and missed out on the podium.