But pedestrian deaths, which account for the largest share of traffic fatalities, have been a difficult problem in a city where many people walk everywhere. The deaths increased to 122 in 2019 from 115 in 2018. The fatalities included a pedestrian who was hit by a truck on New Year’s Eve in Harlem. A 23-year-old man was charged with driving while intoxicated in the death.

The number of people who died in vehicles rose to 44 in 2019, from 38 in 2018. In one bright spot, the number of motorcyclist deaths fell to 25, from 40 in 2018.

The streets of New York City have long been known for being dangerous. The number of traffic fatalities peaked in 1929 at 1,360 deaths, even though there were far fewer cars than there are today. As recently as 1990, there were more than 700 traffic deaths.

In November, Mr. de Blasio signed a law that requires the city to build 250 miles of protected bike lanes in the coming years, along with a dizzying list of other street upgrades. The city must hit specific targets, including building 150 miles of bus lanes that are physically separated from other traffic lanes or monitored by cameras.

The law was crafted by Corey Johnson, the speaker of the City Council who is expected to run for mayor next year. He persuaded the mayor to support the law after Mr. de Blasio’s administration had expressed concerns over its aggressive timeline.

Even as Mr. de Blasio has faced withering criticism from safety groups over traffic deaths, he also won accolades for a new “busway” on 14th Street in Manhattan. The city closed the route to most traffic to prioritize buses.