Ten-man Portugal secured first place in their group after a 3-2 victory in Cardiff, with goals from Bruno Fernandes, Pedro Neto and Carlos Forbs.