Uruguay's Congress has voted narrowly to legalise abortion during the first 12 weeks of pregnancy – a rare move in largely Catholic Latin America.

The Senate voted 17 to 14 in favour of the bill, which was passed by the lower house last month.

During the debate on Wednesday, ruling party Senator Luis Gallo said: "With this law, we are joining the ranks of developed countries that have largely adopted a stance to liberalise, recognising the failure of criminal laws to avoid abortions."

Latin America is home to about half of the world's Roman Catholics and the Church is opposed to abortion under any circumstances. But Uruguay, a country of 3.2 million people, has a strong secular tradition.

Its legislature passed a similar bill in 2008, but the then-President Tabare Vazquez vetoed it. A recent survey showed 52 per cent of Uruguayans believed abortion should be legalised, while 34 per cent were opposed.

Leading opposition parties have said they will push for a referendum to overturn the new law. "There's something very wrong when the state makes it easier to abort than to adopt," opposition Senator Alfredo Solari said. "Abortion... does not seek to protect and preserve... a patient's health. It causes irreparable harm to the embryo or fetus and hurts the pregnant woman, too."

Under current law, abortions are illegal except in a few circumstances, including cases of rape.