Six-time world player of the year Marta scored a record 17th World Cup finals goal to clinch Brazil's place in the last 16 with a 1-0 win over Italy, who topped Group C on goal difference.
The 33-year-old Brazil legend's nerveless, second-half penalty saw her become the all-time leading scorer at men's or women's World Cups, surpassing retired Germany striker Miroslav Klose.
Italy, who had already qualified, went close twice through Juventus' Barbara Bonansea in the first half, but faded after the break in Valenciennes.
But an experienced Brazil side, who clipped the bar through Andressinha's fine second-half free-kick, narrowly missed out on second spot as Australia beat Jamaica 4-1 to pip Vadao's side on goals scored.
The South Americans now look set to face hosts France in the next round in Le Havre on Sunday, unless a relatively unlikely combination of results later this week puts them on a path to meet Germany on Saturday instead.
As group winners, Italy will play against a third-placed team in the last 16, with Nigeria or China their most likely opponents.