Manhattan’s largest apartment complex will be sold for $5.3 billion in a deal that will preserve nearly half its 11,232 units for middle-class families, New York City officials said Tuesday.

“The teachers, the firefighters, the police officers, the nurse, the everyday people who make this city great can live here in the middle of Manhattan,” said Mayor Bill de Blasio, who called the deal for Stuyvesant Town-Peter Cooper Village “the mother of all preservation deals.”