Uruguay's Congress has voted by a razor-thin margin to legalize abortion, a groundbreaking move in Latin America.

No country in Latin America, apart from Cuba, has made abortions accessible to all women during the first trimester of pregnancy.

The vote was 50-49 just before midnight after several congressmen on each side of the debate said they could not in good conscience go along with their parties, and allowed substitutes to vote in their stead.

President Jose Mujica says he will support the legislation if the Senate approves the changes.