Barcelona agree to sell Villa to Atletico Madrid

The 31-year-old, Spain's all-time leading scorer, will move for a fee of up to 5.1 million euros with Barca reserving 50 percent of the rights over any future transfer.

Atletico will pay 2.1 million euros this season, a further 2 million if the player continues to play at the Calderon in the 2014/15 season, and another one million if he extends his contract to 2016, Barca said in a statement.

"The agreement and the signing of Villa as a new player at Atletico will be formalised after the player has taken a medical," Atletico said on their Twitter feed.

The arrival of young Brazil forward Neymar at the Nou Camp had threatened to push Villa even further out of the reckoning in Tito Vilanova's side, after a season where he struggled to hold down a regular first team place.

The signing is something of a coup for King's Cup winners Atletico, who were looking for a replacement for Colombia striker Radamel Falcao after he left to join big-spending Monaco.

At international level, he helped Spain win Euro 2008 and the World Cup in 2010, finishing as the side's top scorer at both tournaments.

He missed Euro 2012 as he recovered from a broken leg suffered in the Club World Cup at the end of 2011, but remains his country's all-time leading scorer with 56 goals from 92 appearances.