Hosts New Zealand are out of the FIFA U-20 World Cup but only after giving Portugal a major fright at Hamilton's Waikato Stadium.

The Europeans were ultimately worthy winners and sealed a 2-1 victory and a place in the quarter-finals thanks to a wonderful late goal by Gelson Martins. The Junior All Whites fought bravely, though, and had threatened a shock win of their own after Stuart Holthusen had cancelled out Raphael Guzzo's first-half opener.

Darren Bazeley's team had made a positive start, playing at a high tempo and forcing the Portuguese back, but the superior class of their opponents soon began to tell. With 17 minutes played, the hosts needed Alex Rufer to keep the scoreline blank Tomas found space at a corner and attempted a clever flick towards goal.

Rony Lopes missed a golden chance soon after, firing wide from a promising position inside the box after Riquicho's cross was deflected into his path. But a goal looked to be coming and, sure enough, Portugal made the breakthrough on 24 minutes. Guzzo was the scorer, collecting a pass from Rafa on the left, turning his marker inside the box and bending a right-foot shot into the bottom-right corner for his first goal of the tournament.

Helio Sousa's side were good value for their lead and should have doubled it just after the hour-mark when Andre Silva wasted a terrific opportunity. The normally deadly No9 was just six yards out when he met Guzzo's header across the face of goal, but he somehow diverted the ball over when it seemed certain the net would bulge.

New Zealand looked to be focused on damage limitation at this stage but then, on 64 minutes and completely against the run of play, they found an equaliser. Monty Patterson bustled his way through the heart of the Portugal defence, benefited from a couple of lucky ricochets, and when the ball fell to substitute Stuart Holthusen, he made no mistake with a shot through the legs of Andre Moreira. With a delighted crowd roaring them on, Bazeley's side now had the bit between their teeth, and the goalscorer missed a good chance to cement his hero status, tugging a right foot shot well wide from an unmarked position.

But Portugal slowly recovered their composure and, with three minutes remaining, silenced the Waikato Stadium with a fantastic winning goal. Gelson Martins claimed it, dancing past a couple of weak challenges before curling a brilliant outside-of-the-foot finish just inside the left-hand post from 20 yards.

It was a goal worthy of winning any match and left Portugal to look forward to a quarter-final against either Brazil or Uruguay.