Chilean President Michelle Bachelet signed a law that recognizes civil unions between same-sex couples, a sign of change in a country long regarded as one South America’s most socially conservative nations.

The measure had been in the works for more than four years, and its signing into law on Monday was hailed by gay advocates as a step toward full marriage rights.