Spain has raised the minimum age for marriage from 14 to 16, having had the lowest marrying age in Europe.
Before the age was raised, boys and girls could marry at the age of 14 with the permission of a judge. It is now level with most European countries.
The change comes only months after the government raised the age of consent from 13 to 16.
The government announced its intention to alter the law in April 2013, but it came into force only on Thursday.
The move was welcomed by officials from Unicef and children's rights groups in Spain.
According to El Pais (in Spanish), only 365 marriages involving under-16s took place in Spain between 2000 and 2014 - with only five in 2014.
In the 1990s, however, there were 2,678 marriages involving at least one under-16 - and 12,867 in the 1980s.
Legal age of marriage in Europe
- 15: Estonia (with court's consent)
- 16: Germany, UK, Italy and others
- 18: France, Belgium, Sweden and others
The average age of marriage in Spain has increased in recent years.
One study by the Statistical Institute of Catalonia showed that, in 2013, men in the region married at an average age of 33.6 years, compared with 32.6 years for women.
Ten years earlier, men married at an average age of 30.7 years, and women at 28.7 years.