Villa, who helped Atletico Madrid win last season's Spanish league title, will join the new club who will begin playing in the MLS in 2015.
The deal is arguably the biggest signing made by an MLS team since David Beckham joined L.A. Galaxy with the 32-year-old Villa a current world champion.
Villa signed a three-year deal with NYCFC, who are jointly owned by Premier League side Manchester City and baseball's New York Yankees.
"This is a historic and exciting moment for the City family and the building of New York City Football Club," said club chief executive Ferran Soriano.
"I know David really well; he is one of the best footballers in the world, a true winner and in an outstanding moment of his career. I'm sure New Yorkers will enjoy watching him play for their city," he said.
Villa was part of the hugely successful Barcelona team under Pep Guardiola and he will wear the number seven shirt he graced at the Nou Camp.
"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," he added.
Villa joins another former Barcelona player in New York - former France international Thierry Henry plays for the New York Red Bulls, who are based in Harrison, New Jersey.
David Villa tweet: So excited to be the first player in the history of @NYCFC! I'm ready for this new challenge! #VillatoNYCFC pic.twitter.com/q1ygpyKYLv
- Sports & Recreation
- New York Yankees
- David Beckham
- Manchester City