The city comptroller, Scott M. Stringer, who sat next to Mr. de Blasio at the news conference, tempered his enthusiasm on the pension divestments, saying, “We’re setting a formal goal to divest from fossil fuels.” He added that any decision would be complex, take time and must be viewed through a “lens of sound fiscal stewardship.” He said the goal was to complete the divestment within five years.

Trustees for the city’s five pension funds would need to approve any divestment, weighing its effect on the funds’ performance. A resolution submitted on Wednesday to the boards of the five funds called for them to “initiate a process for determining a prudent divestment” strategy in keeping with the fiduciary duty to responsibly manage the funds. It called for the boards to hire a consultant to study the issue and its impact on risk and return.

Mr. de Blasio said that a majority of the trustees on two of the funds — one for teachers and another for many employees not including police officers or firefighters — were ready to support divestment.

Some participants in the news conference noted that under Mayor de Blasio, the city’s pension funds had previously divested from companies involved in the coal industry, as well as from private prison companies. But those investments represented a total of about $60 million, far less than the estimated $5 billion invested in fossil fuel companies. The total amount managed by the funds is about $189 billion.

The divestment announcement comes less than a month after Gov. Andrew M. Cuomo promised to cease the state’s investments in entities “with significant fossil-fuel activities,” and created an advisory committee to “develop a decarbonization road map.”

The news conference Wednesday was held at a Lower Manhattan community center that Mr. de Blasio said had been flooded during Hurricane Sandy. It was attended by activists wearing buttons calling for divestment, who applauded frequently as Mr. de Blasio, Mr. Stringer and other officials spoke.

Mr. de Blasio has made other grandiose pledges to combat climate change. Last September he announced that the city would force the owners of large buildings, including apartment houses and office buildings, to retrofit them to save energy. But what he ultimately revealed was a vague plan that needed to be fleshed out and then enacted by the City Council, which quickly distanced itself from the announcement.