Norway suffered a shock defeat in the premiere against Brazil and needed a win in the group finale against Portugal to avoid entering the intermediate round pointlessly.
But a nervous Norway didn't manage to do so.
Despite taking a three-goal lead, 19-16, at the beginning of the second half, the home team couldn't hold on.
Instead, Portugal turned the match around and managed to hold on in a dramatic game.
Goalkeeper Gustavo Capdeville and top scorers Francisco Costa and Luis Frade stood out for Portugal.
Portugal advances to the intermediate round with four points, Brazil with two, and Norway has zero.
The remaining three teams in the intermediate round will come from Sweden's group. Sweden will face Spain in the group finale on Monday and will at least bring two points to the intermediate round.