The Pacific Islanders needed a point to progress and knock two-time champions Australia out in the group phase for the first time in World Cup history.
They managed that courtesy of a bonus point awarded for losing by less than eight points, setting up a last-eight clash with England.
Rodrigo Marta scored a try for Portugal two minutes from time and Samuel Marques converted it to earn his side an emotional win.
Portugal, who played without fear and great attacking intent, also claimed tries through Raffaele Storti and Francisco Fernandes as Samuel Marques kicked nine points from the tee.
Related News