- Cristiano Ronaldo scores twice in Portugal's 3-3 draw with Hungary
- Hungary qualifies for knockout phase as group winner
- Ronaldo had yet to score in the tournament before this match
- Portugal to face Croatia in knockout round
Having previously failed to score in the tournament, Ronaldo netted twice as Portugal came from behind three times in the 3-3 draw with Hungary in Lyon.
The result was enough to secure third place in Group E for Portugal -- despite Fernando Santos' team drawing all of its three games.
It means Portugal will now face Croatia in the next round in Lens on Saturday.
Hungary hadn't been tipped to make it through to the last 16, but took five points from its three matches to top the group and edge Iceland into second.
With both teams abandoning any notion of defense, Portugal and Hungary went head-to-head for 90 minutes in a thrilling contest.
Much maligned after his missed penalty cost Portugal victory against Austria at the weekend, Ronaldo was frequently at the heart of the action.
The scorer of 364 goals in 348 games for Real Madrid, the Portugal captain had looked a shadow of himself prior to Wednesday and earlier in the day had clashed with a television reporter while out walking with his teammates -- an incident which led to him throwing a microphone into a nearby lake.
If that was supposed to distract him, it appeared to have worked -- in the first half at least -- as Portugal and Ronaldo struggled badly.
Trailing to Zoltan Gera's tremendous strike -- a wonderful half-volley -- Portugal's participation in the tournament appeared endangered.
But with three minutes of the first half remaining, Ronaldo unlocked the Hungary defense with an exquisite through ball, allowing Nani to fire home an equalizer.
End to end
That goal was supposed to settle Portugal down but if anything it only served to rouse Hungary once again.
Balazs Dzsudzsak's deflected free kick gave Hungary a 2-1 advantage before Ronaldo hit back with a sublime finish using his heel to become the first player to score at four consecutive European Championship finals.
It was a wonderful moment of individual brilliance and understandably Ronaldo celebrated with his trademark exuberance.
The Real Madrid star has all too often carried this Portuguese side and he was soon carrying it again after Dzsudzsak, a constant nuisance in attack, curled home a fine effort with the aid of the deflection to spark scenes of wild Hungarian jubilation.
Having never made it out of the group stage of a major tournament since the 1966 World Cup, Hungary was playing with great energy and enthusiasm as if to make up for lost time.
But their joy was quickly tempered as Ronaldo struck for a second time, heading home Ricardo Quaresma's cross to make it 3-3.
Both teams moved forward in search of a winner and Hungary midfielder Akos Elek smashed an effort against the post as his side caught the Portuguese on the counter attack.
But a winner was not forthcoming with the draw proving enough for both teams to qualify for the knockout phase.
"It was a crazy game, we were out of the European Championship three times, and we were always chasing the game," Ronaldo said.
"It was a difficult game, it was very hot, but the main objective was to go through. We qualified in third; obviously our objective was to win the game and finish first or second if possible, but we've managed our objective, we're through, that was our objective, so we should congratulate ourselves."