The United States claimed a 2-1 win over Australia on Wednesday as the record four-time gold medalists set up a quarterfinal match against Japan in the women's Olympic soccer tournament, while Brazil legend Marta was sent off in her side's 2-0 defeat by Spain.

Japan finished second in its group after beating Nigeria 3-1 in Nantes, with Maika Hamano, Mina Tanaka and Hikaru Kitagawa scoring goals, the latter from a fine free-kick. Jennifer Echegini replied for Nigeria.

Japan's only loss of the group stage came at the hands of Spain in the opening match.

For the U.S., goals on either side of halftime by Trinity Rodman and substitute Korbin Albert made the difference in Marseille, although Alanna Kennedy pulled one back in stoppage time at the end of the game for Australia.

The United States, coached by English former Chelsea boss Emma Hayes, finished on top of Group B with a perfect record.

Team Japan celebrates after securing its place in the Olympic knockout stages with a 3-1 win over Nigeria on Wednesday.
Team Japan celebrates after securing its place in the Olympic knockout stages with a 3-1 win over Nigeria on Wednesday. | AFP-JIJI

They will now take on Japan in Paris on Saturday in a repeat of the 2012 London Olympic final, which was won by the U.S.

In other action, Germany secured second place in Group B with a 4-1 win over Zambia in Saint-Etienne in which Lea Schueller scored twice and both Klara Buehl and Elisa Senss were also on target, with Barbra Banda grabbing a consolation.

Gold medalists in 2016, Germany will go to Marseille for a quarterfinal against Canada, which escaped from its group despite being docked 6 points over a drone spying scandal.

Other quarterfinal matchups will see France take on Brazil and Spain battle Colombia.