Centre-right leader Luis Montenegro was appointed prime minister of Portugal on Wednesday night, but will have to form a coalition government and grapple with a growing far right after his party’s narrow victory in parliamentary elections.