Another difference from three years ago is the increase in the number of for-hire vehicles now on the road. There are more than 100,000 for-hire vehicles in New York City, up from 63,000 in 2015, according to city data. More than 80,000 of them are associated with ride-hailing apps.

Every time he publicly spoke about the legislation, Mr. Johnson made the point that the number of vehicles on the road would not change.

The opposition’s strategy also changed from 2015.

Uber officials acknowledge not going as hard after Mr. de Blasio this time. They chose not to attack the mayor or others for having received campaign donations from the yellow-cab industry. And this time around, Gov. Andrew M. Cuomo, who spoke out against a cap three years ago, did not oppose it.

Uber instead enlisted the help of civil rights leaders such as the Rev. Al Sharpton and Marc H. Morial, the chief executive of the National Urban League, to characterize a cap as a civil-rights issue, affecting the ability of minority residents outside of Manhattan to access broad transportation options.

Indeed, some Council members, in explaining their vote on Wednesday, expressed deep concern over riders being discriminated against, based on their race or neighborhood. Nonetheless, the one-year cap passed 39 to 6.

“We gave them a full seat at the table so they couldn’t say that they didn’t get to participate,” Mr. Johnson said of Uber. “We listened to their concerns, we looked at the data,” he said, adding, “we tried to come up with a sound public policy solution.”

Uber still plans to pursue expansion by getting drivers for other for-hire companies to drive for them. They say that one aspect of the new legislation, which promoted minimum compensation for drivers, will help with recruitment.