New York City has financed more than 20,000 affordable housing units -- either planned, built or preserved -- in the past fiscal year, Mayor Bill de Blasio announced Monday.

The 20,325 affordable apartments and homes are the most in one year since 1989 and, de Blasio said, proof he is making good on a pledge to secure 200,000 homes for low- to middle-income residents within a decade.

"It's one thing to put together the financing, put together the plan, get the land," de Blasio said at a news conference in front of a Bronx apartment building under construction. "What we like seeing is when the construction begins and we move toward the day when a family can move in."

The 20,000-plus units represent a $618 million city investment, the mayor said. They include hundreds of units reserved for formerly homeless residents, seniors and lowest-income families -- those making less than $23,350.

"There is a secret formula to New York City. There always has been," de Blasio said. "It only works because it's a place for everyone."

The number of affordable units secured in the fiscal year ended July 1 includes 8,483 in new construction -- the most annually since the city's Department of Housing Preservation and Development was created in 1978 -- and 11,842 preserved at below-market cost, the mayor's office said.

City Council Speaker Melissa Mark-Viverito said low-priced housing is crucial for families fearing displacement as housing costs skyrocket.

"That is the No. 1 cost that unfortunately is forcing people out of their communities," Mark-Viverito said. "And if we can, as a city, do all we can to control that cost, we're making communities livable for those who helped create those communities."

Under Mayor Ed Koch's housing program, 25,432 affordable units were built or saved in 1989.

Brooklyn had the most affordable units in the past year -- 6,915. The majority of the units secured across the city -- 14,116 -- are for families making between $39,000 and $62,000.