Villa said on his new club's website, nycfc.com: "Throughout my career I've always tried to keep pushing myself to achieve new targets and this represents another important goal for me.
"I want to try and help MLS continue to grow, through playing, working hard, scoring goals and at the same time try to make New York City FC become the best team in the league.
"It's a real honour that the people who have formed the club have focused their attention on me. I'm keen to do the best I can, take on board that extra responsibility and prove my worth by repaying the confidence they have shown in me."
New York City sporting director Claudio Reyna said: "David is the perfect first signing for New York City FC. His individual accomplishments are remarkable.
"His experiences, including winning the 2010 World Cup, will be invaluable for building our club's sporting culture. I couldn't be more excited to welcome him to New York City and have him as our club's first player."
For the big stories and the banter follow us on Twitter: @tribalfootball