Angola's parliament has also voted to ban discrimination against sexual orientation with offenders facing up to two years in prison.
Angola's parliament has decriminalised homosexuality, removing a notorious "vices against nature" provision in its penal code and banning discrimination against sexual orientation, in a reform hailed by rights watchdogs.
On Wednesday, 155 parliamentarians voted for Angola's first overhaul of the criminal statute books since independence, while seven abstained and one voted against.
"Angola has finally shed the divisive 'vices against nature' provision in its law," Human Rights Watch (HRW) said in a statement.
"In casting aside this archaic and insidious relic of the colonial past, Angola has eschewed discrimination and embraced equality."
While Angola had no known prosecutions under the old law, HRW said the contested provision harmed the rights of gay, bisexual and transgender people and exposed their lives to painful scrutiny.
The new legislation is the first overhaul of Angola's criminal code since it gained independence from Portugal in 1975.
The new law also aims to shore up protection against sexual discrimination.
Anyone who refuses to employ individuals or provide services to them on the grounds of sexual orientation will be liable to a jail term of up to two years.
"The 69 other countries around the world that still criminalise consensual same-sex conduct should follow its (Angola's) lead," HRW said.
In a historic moment last year, Angola gave legal recognition to a gay rights lobby group called Iris Angola, marking a major breakthrough in a closed and conservative society.
Angola has been led since September 2017 by President Joao Lourenco, who succeeded Jose Eduardo dos Santos, the country's ruler for almost four decades.
Lourenco has sought in several ways to distance himself from his predecessor.
He has launched a campaign against corruption that has netted several top officials from the last government.
He has also sought to mend fences with the international community, which has long been critical of Angola's human rights record, and expressed interest in joining the Commonwealth and international francophone community.