Malaga make Cazorla latest signing
Neither team published financial details of the deal but local media reported that Malaga had agreed to pay 20 million euros for the 26-year-old, which would be a club record fee.
One of a group of talented playmakers in the current Spain squad, Asturian Cazorla came through the youth ranks at Real Oviedo before joining Villarreal in the 2003-04 season.
He made his debut for Spain in May 2008, helping them to victory at Euro 2008 later that year, but a back injury meant he missed out on their World Cup triumph in South Africa last year.
"They have been very enjoyable years but football carries on and I have a very exciting project ahead at Malaga and now I must focus on that," Cazorla said at a farewell news conference at Villarreal's training ground.
Malaga, on Spain's southern coast, were bought by a member of the Qatari royal family at the end of the 2009-10 campaign and have been by far the busiest Spanish club in the transfer market since the end of last season when they finished 11th in La Liga.
Managed by former Real Madrid coach Manuel Pellegrini, they have landed various players, including Dutch striker Ruud van Nistelrooy and French midfielder Jeremy Toulalan and hope to challenge for a place in European competition next season.
Earlier this month they appointed former Spain sporting director Fernando Hierro as general manager.
Malaga-born Hierro, a former Real Madrid and Spain player who also had a brief stint at English Premier league club Bolton Wanderers, stepped down from his role with the Spanish football federation (RFEF) at the end of last month.