Aetna is investing $89 million to transform 145,000 square feet in a building on Ninth Avenue into its new home, according to Empire State Development, New York State’s economic development agency.

Efforts to lure the company were highly competitive — Aetna considered numerous cities for its new home, but in the end, after protracted negotiations, New York State offered one of the most attractive deals. Besides the state tax credits, which are based on the number of new jobs Aetna creates, the New York City Economic Development Corporation will provide nearly $10 million worth of incentives through a combination of property and sales tax credits, among other benefits.

“New York City is where talent and technology come together,” Mayor Bill de Blasio said. “We’ve never been stronger.”

Hartford had agreed to match the package after news broke this year about Aetna’s plan to move, according to the administration of the Connecticut governor, Dannel P. Malloy. But as the company places greater emphasis on creating digital tools for people to manage their health care, being in New York City, with its large reservoir of talent, seemed vital to the company’s future, said Mark T. Bertolini, Aetna’s chairman and chief executive.

New York provides “the ecosystem of having people in the knowledge economy, working in a town they want to be living in, and we want to attract those folks, and we want to have them on our team,” Mr. Bertolini said in an interview. “It’s very hard to recruit people like that to Hartford.”