South Africa are through to the last 16 after claiming their first Women's World Cup win with a thrilling 3-2 victory over Italy in Wellington.
Thembi Kgatlana's 92nd-minute winner proved the difference after Italy fought back to level with an Arianna Caruso header.
A draw would have been enough to take Italy into the knockout rounds.
South Africa will play Group E winners the Netherlands on Sunday.
After earning a first World Cup point in their 2-2 draw with Argentina, South Africa have shown significant progress from their debut appearance at the tournament in 2019, when they lost all three group matches.
There were scenes of jubilation for the South Africa players when the final whistle confirmed they had made history for their nation.
With a win certain to guarantee their place in the knockout rounds, Italy got off to the perfect start when they were awarded a penalty as Karabo Dhlamini caught the heels of teenager Chiara Beccari.
Referee Maria Carvajal awarded a free-kick, but a swift video assistant referee intervention concluded the foul had been committed inside the penalty area and Caruso calmly converted from the spot to put Italy in command of their World Cup future.
However, South Africa were gifted a leveller as Benedetta Orsi, playing her first World Cup match, was left red-faced when she hit a no-look back pass to an unexpectant Francesca Durante and it rolled into her own net.
Desiree Ellis' side burst into the lead when Kgatlana slipped a clever ball through the Italy defence to put Hildah Magaia through on goal and she lifted it over Durante.
VAR seemed like it may have come to South Africa's rescue when Caruso equalised from a corner, but after a lengthy delay the goal was given.
Italy hearts were broken when Magaia stepped through the defence and squared it Kgatlana, who made no mistake in finding the back of the net.
Player of the match
KgatlanaThembi Kgatlana
South Africa
Squad number11Player nameKgatlana
Squad number8Player nameMagaia
Squad number10Player nameMotlhalo
Squad number3Player nameGamede
Squad number12Player nameSeoposenwe
Squad number4Player nameMatlou
Squad number20Player nameMoodaly
Squad number7Player nameDhlamini
Squad number2Player nameRamalepe
Squad number23Player nameShongwe
Squad number22Player nameKgoale
Squad number18Player nameHolweni
Squad number14Player nameMakhubela
Squad number13Player nameMbane
Squad number1Player nameSwart
Italy
Squad number10Player nameGirelli
Squad number20Player nameGreggi
Squad number9Player nameGiacinti
Squad number13Player nameBartoli
Squad number18Player nameCaruso
Squad number7Player nameCantore
Squad number17Player nameBoattin
Squad number14Player nameBeccari
Squad number11Player nameGlionna
Squad number8Player nameBonansea
Squad number4Player nameDi Guglielmo
Squad number5Player nameLinari
Squad number22Player nameDurante
Squad number6Player nameGiugliano
Squad number3Player nameOrsi
Squad number16Player nameDragoni
Line-ups
South Africa
Formation 4-2-3-1
1Swart
2Ramalepe13Mbane4Matlou7Dhlamini
20Moodaly3Gamede
8Magaia10Motlhalo12Seoposenwe
11Kgatlana
1Swart2RamalepeSubstituted forMakhubelaat 90+5'minutes13Mbane4Matlou7DhlaminiSubstituted forHolweniat 90+15'minutes20MoodalySubstituted forKgoaleat 45'minutes3Gamede8MagaiaSubstituted forShongweat 90+5'minutes10Motlhalo12Seoposenwe11KgatlanaSubstitutes
5Magama6Cesane9Salgado14Makhubela16Dlamini17Kgadiete18Holweni21Moletsane22Kgoale23ShongweItaly
Formation 4-2-3-1
22Durante
4Di Guglielmo3Orsi5Linari17Boattin
18Caruso6Giugliano
14Beccari16Dragoni8Bonansea
9Giacinti
22Durante4Di GuglielmoSubstituted forBartoliat 64'minutes3OrsiSubstituted forGlionnaat 90+10'minutes5Linari17Boattin18CarusoSubstituted forGreggiat 84'minutes6Giugliano14BeccariSubstituted forCantoreat 84'minutes16Dragoni8BonanseaSubstituted forGirelliat 64'minutes9GiacintiSubstitutes
1Giuliani2Severini7Cantore10Girelli11Glionna12Baldi13Bartoli15Serturini19Lenzini20Greggi21Cernoia23SalvaiReferee:María CarvajalAttendance:14,967Live Text
Match ends, South Africa 3, Italy 2.
Second Half ends, South Africa 3, Italy 2.
Attempt blocked. Benedetta Glionna (Italy) with an attempt from the centre of the box is blocked. Assisted by Valentina Giacinti with a headed pass.
Delay over. They are ready to continue.
Substitution, South Africa. Sibulele Holweni replaces Karabo Dhlamini because of an injury.
Delay in match because of an injury Karabo Dhlamini (South Africa).
Foul by Valentina Giacinti (Italy).
Nomvula Kgoale (South Africa) wins a free kick in the defensive half.
Attempt saved. Elena Linari (Italy) header from the centre of the box is saved in the bottom right corner. Assisted by Lisa Boattin.
Substitution, Italy. Benedetta Glionna replaces Benedetta Orsi.
Elisa Bartoli (Italy) wins a free kick in the attacking half.
Foul by Wendy Shongwe (South Africa).
Corner, South Africa. Conceded by Giada Greggi.
Corner, South Africa. Conceded by Elisa Bartoli.
Substitution, South Africa. Tiisetso Makhubela replaces Lebohang Ramalepe.
Substitution, South Africa. Wendy Shongwe replaces Hildah Magaia because of an injury.
Delay over. They are ready to continue.
Delay in match because of an injury Hildah Magaia (South Africa).
Attempt missed. Valentina Giacinti (Italy) right footed shot from the centre of the box is close, but misses the top right corner. Assisted by Cristiana Girelli.
Goal! South Africa 3, Italy 2. Thembi Kgatlana (South Africa) right footed shot from the centre of the box to the centre of the goal. Assisted by Hildah Magaia.