Former Portuguese Prime Minister Antonio Guterres has been formally elected as the next UN Secretary General.