Spain has raised the minimum age for marriage from 14 to 16 to boost protection of minors and bring the country in line with its European Union neighbours.