Villa looked a threat throughout his first appearance Down Under and went close with a long-range drive before nodding into the side netting in the first half.
© Getty Images
Spain's all-time record goalscorer threatened once more shortly after the interval, but his 20-yard shot was comfortably held by Mark Birighitti.
Villa should have put the home side ahead in the 61st minute, but he uncharacteristically volleyed over from close range.
The miss proved costly as Edson Montano thumped home a header 60 seconds later to give the visitors the lead.
City drew their opening game of the season, but it looked as though they were going to leave the AAMI Stadium empty handed when David Carney twice cleared Brodie Mooy strikes off the line.
However, with three minutes remaining, Villa lashed the ball home from the edge of the box to ensure that Melbourne's unbeaten start to the season continued.