As part of that effort, city workers have been going door to door since last summer to identify tenants who are not receiving essential services such as heat or hot water; in those cases, the city does repairs and charges the landlord. Other times, they identified tenants who were threatened with illegal eviction and city lawyers have intervened in court cases, at no cost to the tenant.

Most low-income tenants in New York still face their landlords’ lawyers without representation of their own. Elected officials, legal scholars and tenant groups in the city and nationwide have long pushed to establish a right to counsel in civic actions that affect basic needs like housing, but the cost is high. In New York City, it is estimated such an effort would cost more than $100 million.

The $46 million the city has spent on legal services for tenants over the last two years has brought sizable savings in services for homeless people, given that about a third of families that enter shelters were evicted from private housing, studies show.

One legal services agency, Legal Services NYC, has hired about 90 additional “housing case handlers” — most of them lawyers — since 2014, said Edward Josephson, the director of litigation.

He said the lawyers helped negotiate more time for payments of back rent, fought any overcharges and took landlords to court in cases in which problems have been neglected or tenants have been harassed.

“We’ve had two years to ramp up,” Mr. Josephson said of the increased funding his agency received from the city.

Most cases are over nonpayment of rent, and landlords welcome the declining number of evictions as well. Owners go to court for rent money, not looking for evictions, said Mitchell Posilkin, general counsel for the Rent Stabilization Association, a landlord group.