Jorge Sampaio, a former Portuguese president who later served in various UN posts, died on Friday at his home in Lisbon, his family told the Lusa news agency. He was 81.
"Jorge Sampaio left us today, leaving us with a heritage of not only liberty but also equality," President Marcelo Rebelo de Sousa said.
The government declared three days of national mourning to commemorate Sampaio, starting on Saturday.
"We bow before the memory of someone who has always been an example," said Prime Minister Antonio Costa.
Sampaio was president of Portugal between 1996 and 2006. He suffered from heart problems and was hospitalised at the end of August.
Born into a middle-class family in Lisbon in 1939, Sampaio entered politics in 1962 while studying law, when he organised university strikes against the Antonio Salazar dictatorship.
Once he passed the bar exam, he defended several political prisoners.
In 1978, four years after the Carnation Revolution that overthrew the dictatorship, Sampaio joined the Socialist party.
He became the head of the party in 1989, the same year that he was elected as mayor of Lisbon.
He easily won the 1996 presidential election, beating his opponent from the right Anibal Cavaco Silva in the first round.
After serving two terms, he went on to work at the United Nations, including as a special envoy on tuberculosis.
He leaves behind two children.