Villa, unveiled by Major League Soccer club New York City as its inaugural player this week, will take the field for Melbourne between October and December this year prior to the start of the American season.
The 32-year-old, who joined New York after helping Atletico Madrid win the Spanish league title, is his country's all-time top scorer with 56 goals and will play for the world champions at his third World Cup in Brazil this month.
"It's very good for me in every sense," he said in a statement.
"From a football point of view it's the opportunity to play in a new league in a different country, and of course it will be ideal for me to get some competitive football in the period before the MLS season gets under way.
Also Read
"I'm sure that playing for Melbourne City FC will be a marvellous experience. I'll be giving everything for the team, just like I have with every club I've played for."
"We are very proud to have David Villa as part of the City family and are thrilled to announce he will play for Melbourne City FC in the A-League this (coming) season," said Ferran Soriano, chief executive of the City Football Group.
"The sports fans of Melbourne can look forward to seeing one of the best players in world football representing their city when David brings his rare talents to AAMI Park later this year.