The Portuguese club says on its website that the 33-year-old Capdevila's contract also included a ?20 million ($28 million) buy-out clause. The cost of the transfer was not revealed.
Capdevila is seen as a likely replacement for Fabio Coentrao at fullback after the Portugal international joined Real Madrid in a ?30 million ($43 million) deal. The former Deportivo La Coruna defender leaves Villarreal after four seasons.
Capdevila has made 57 appearances for Spain and was a starter as Spain won the World Cup last year and the European Championship in 2008.