If Portugal beats Hungary, it will win the group if Austria wins or ties its game against Iceland. If Iceland wins, Portugal could come in second, depending on the goal differential.
If Portugal ties Hungary, it is in trouble. It would need an Iceland-Austria tie, but it trails Iceland on goal differential, so Portugal would need to score more goals in its tie with Hungary than Iceland does in its game with Austria. It’s complicated; consult the chart. It could tie and end in third place, but with three points, third place may not be enough to advance.
Portugal loses to Hungary, it is almost certainly eliminated. It could end in third place, but a Round of 16 berth with just two points is almost impossible.
Here's the link:
http://www.nytimes.com/interactive/2016/06/18/upshot/euro-2016-how-portugal-can-advance-to-the-next-round.html?_r=0