(CNN) - Not even Marta making history could stop Brazil crumbling to defeat in an astonishing Women's World Cup match against Australia.
Having fallen 2-0 behind in the first half, Australia's hopes of progressing from Group C appeared to be in tatters, but a brilliant fightback secured a 3-2 win to keep alive the Matildas' chances of progressing to the knockout stages.
A surprise defeat by Italy on Sunday had left Australia, ranked sixth in the world, needing a result against the Brazilians in Montpellier, but even a point seemed unlikely when Australia was 2-0 down by the 38th minute.
Captain Sam Kerr, who was involved in two of the night's goals, said in a TV interview after the victory: "I'm so proud of the girls. There was a lot of critics talking about us but we're back so suck on that one.
"It's just outside noise, we don't listen to the haters. Look at that performance comeback back from the deep. I love these girls, they are something else."
Ante Milicic -- who became Australia's coach in January after Alen Stajcic's surprise sacking -- told reporters that the win was "one of the finest Australian performances I've seen."
The Matildas fought back against a side that had last lost a group stage match in 1995, ending a run of three consecutive defeats in the process.
Indeed, only one other team -- Sweden in 1995 against Germany -- has come back from two goals down in the Women's World Cup.
"I'm really really proud for the girls because it hasn't been easy for them," added Milicic, taking charge of only his seventh game.
"They deserve all the rewards that they were given. The circumstances that we won the game and the three points will be a massive confidence booster for them so I'm really delighted for them. They never stopped believing, the coaching staff never stopped believing."
Brazil went ahead through Marta, who scored her 16th World Cup goal and in the process became the first player to score in five editions of the tournament.
It was Elise Kellond-Knight who held onto the falling Leticia Santos for too long inside the box to allow Marta -- who was substituted at the break -- to score from the penalty spot and add to her status as the most prolific goalscorer in Women's World Cup history.
Cristiane -- who on Sunday became the oldest player to score a World Cup hat-trick in either the men's and women's version -- scored her fourth of the tournament with a delicate, but precise, header into the bottom-right corner.
But before half-time Caitlin Foord gave the Matildas a lifeline by guiding Tameka Yallop's cross into the net, while a cross by Chloe Logarzo -- intended for captain Sam Kerr -- curled into the net to draw the Matildas level.
Australia's third goal was only given after a lengthy VAR review.
After Monica had headed the ball into her own net, the goal was initially disallowed as Kerr was deemed offside. But having reviewed the play, the referee awarded the goal, judging that Kerr -- running into the box and a few meters ahead of Monica -- was not interfering with play.
The result means three teams in Group C are on three points, with Italy -- playing Jamaica on Friday -- having played one fewer games than Australia and Brazil.
Germany qualifies after China win
In the day's other match, China beat World Cup debutants South Africa 1-0 thanks to a Li Ying volley minutes before half-time.
China's victory meant Germany -- which has won its opening two games -- qualifies for the last 16. China and Spain, level on three points, will play each other on Monday in a match which will decide second place.
South Africa, playing in the Women's World Cup for the first time in its history, will need to achieve what would be a remarkable upset by beating Germany comfortably to hope to qualify for the knockout stages.
The-CNN-Wire ™ & © 2019 Cable News Network, Inc., a Time Warner Company. All rights reserved.