Anissa Lahmari's winner powered World Cup debutants Morocco past Colombia 1-0 on Thursday and into the last 16 at the expense of two-time champions Germany.
Morocco's upset in Perth lifted them to six points and they finished runners-up in Group H to Colombia on goal difference.
Germany were eliminated after being held to a 1-1 draw with South Korea in Brisbane.
Colombia will play Jamaica in the round of 16, while Morocco face France.
It was a fairytale result for Morocco, who have rebounded from a humiliating 6-0 drubbing on their debut against Germany with wins over South Korea and Colombia.
In front of 17,342 fans, the sole goal arrived moments before half-time when Ibtissam Jraidi was impeded in the box by a clumsy Daniela Arias.
Captain Ghizlane Chebbak's penalty kick was spectacularly saved by lunging goalkeeper Catalina Perez, who dived to her left.
But Sakina Ouzraoui pounced on the deflection and her nifty pass found Lahmari who made no mistake from close range.
Colombia, wearing their yellow shirts, fielded a full-strength team despite having effectively qualified to the last 16 before this game.
Real Madrid striker Linda Caicedo, who was diagnosed with ovarian cancer at 15 but made a full recovery, took her place after x-rays cleared her of any health issues.
Caicedo, who scored goals in Colombia's wins against South Korea and Germany, had suffered breathing difficulties against the Germans just days after collapsing in training with chest pain.
Midfielder Mayra Ramirez overcame a knee injury sustained against Germany.
But Morocco took heed of coach Reynald Pedros' plea to play aggressively with a dashing Jraidi forcing Perez into a save in the opening minute.
An attacking Morocco continued to dictate the early exchanges with Chebbak and Fatima Tagnaout particularly influential.
Tagnaout set up Lahmari whose long-range strike on the half hour sailed well over the bar.
Caicedo had limited impact and copped an errant tackle to her foot which had her writhing on the turf.
She was finally involved just before half-time with several menacing dashes down the right, but Colombia couldn't capitalise.
Morocco made them pay with Lahmari's goal putting the group on a knife's edge at the interval.
Colombia came out aggressively and almost equalised on the hour when Daniela Montoya's bullet was brilliantly saved by Morocco goalkeeper Khadija Er-Rmichi.
They continued to press with Ramirez slamming a powerful shot from a tight angle into the right post.
But Morocco hung on to trigger wild celebrations from their players.