Portugal recovered from shock loss to Ireland on Thursday to qualify, while Norway is through for first time since 1998.