Mayor Bill de Blasio staged an unusual rally in Union Square Thursday to celebrate the city’s first-in-the-nation legislation capping the number of Uber and other for-hire vehicles.

The move has sparked concerns from the city’s growing technology sector that the regulations targeting ride-hailing apps — and earlier in the week reining in Airbnb — could become more prevalent.

During the rally, Hizzoner did little to assuage those concerns — hailing the package of bills as a victory over “corporate greed.”

“It sends a message about the resolve of New York City. No big corporation will tell us what to do — not big oil, not the big pharmaceutical companies, and certainly not Uber,” he said. “This is a beautiful day in every way. It is a day of victory. How sweet it is, everybody! How sweet it is!”

The mayor had tried to push similar legislation through the City Council in 2015 but was rebuffed by then-Council Speaker Melissa Mark-Viverito and overwhelmed by a powerful counter-attack from Uber.

On Thursday, three years after that embarrassing defeat, dozens of members of the Taxi Workers Alliance and 32BJ SEIU chanted, “The drivers defeat[ed] the billionaires!”

The council’s package of bills not only set a one-year moratorium on new licenses but mandated that the Taxi and Limousine Commission set a minimum hourly rate for drivers.

A recently completed study commissioned by the agency found that the pre-tax rate should be set at $17.22 per hour.

Council Speaker Corey Johnson insisted the legislation was not a punitive measure against ride-sharing companies, but rather an attempt to bolster drivers who have been suffering from the industry’s over-saturation.

He noted that 40 percent of drivers earn so little that they qualify for Medicaid and 18 percent qualify for food stamps.

“The human side of this was never lost on me,” said Johnson, who read the names of six drivers who have committed suicide in the face of financial concerns since December.

Critics have said the slew of bills, which the mayor has said he would sign, are a gift to the yellow taxi industry — which gave de Blasio more than $500,000 in donations in the 2013 mayoral election.

Council members have also collected tens of thousands of dollars in donations from the traditional taxi industry, which has been struggling as the number of ride-sharing licenses has more than doubled since 2013.

“This used to be a job you could actually live on,” said Mali native Bourema Niambele, who has been driving a taxi since 2006. “Now everyone I know works two or three jobs. More and more we are driving around empty.”