Thembi Kgatlana scored a last-gasp winner to give South Africa their first ever Women's World Cup win with a 3-2 victory over Italy that sent them through to the last 16 of the tournament.
Striker Kgatlana struck two minutes into stoppage time to set up a clash with the Netherlands in Sydney on Sunday and broke the hearts of the Italians, who had only needed a draw to progress.
Italy had appeared to salvage the draw they needed when Arianna Caruso scored from a corner in the 74th minute but were left to rue what could have been after a series of late missed chances.
"They fought like warriors," said an emotional coach Desiree Ellis, who was a founding member of the South Africa women's side in 1993.
"They fought like the heroines that we know that they are. They fought to be historically remembered and they've made history not just getting our first win, but going to the round of 16 and that is freaking amazing."
The Italians had opened the scoring when Karabo Dhlamini tripped Italy forward Chiara Beccari just inside the box in the 10th minute and Caruso put the penalty into the bottom left corner of the net.
South Africa equalised in the 32nd minute through an own goal from Benedetta Orsi, who did not check where goalkeeper Francesca Durante was before making a back pass.
Banyana Banyana went ahead for the first time in the 67th minute when Kgatlana's neat inside pass found Hildah Magaia free behind the defensive line and the forward swept it into the net.
Caruso grabbed her second of the match seven minutes later from a corner when the ball caught her hip in a goalmouth scramble and cannoned into the bottom right corner of the net.
It looked as though Italy might hang on for the draw in a frantic finale but Magaia's pass found Kgatlana in the box and the striker smashed the ball into the net to secure second place in the group behind Sweden.