Opponents of the measure — including Mr. Patrick, pastors of conservative megachurches and the former Houston Astros baseball star Lance Berkman — said the ordinance had nothing to do with discrimination and was about the mayor’s gay agenda being forced on the city. They denied that they had any bias against gay people, and said the ordinance was so vague that it would make anyone who tried to keep any man from entering a women’s bathroom the subject of a city investigation and fine.

“The mayor has never been able to produce a shred of evidence that’s credible of any need for this ordinance, other than everybody else is doing it,” said Dave Welch, the executive director of the Houston Area Pastor Council.

The immediate effect of the vote is unclear. Ms. Parker and her supporters said Houston would lose tourism and convention business if the city had to repeal the ordinance and became known for intolerance, just as a backlash in Indiana over a religious-objections law led to convention cancellations and boycotts before that law was changed. Supporters worried that a repeal of the Houston ordinance could also jeopardize its selection as host city for the Super Bowl in 2017.

Ric Campo, a real estate developer who is the chairman of the Houston Super Bowl Host Committee, said the committee has had conversations with National Football League officials about the ordinance. “I don’t think it’s the straw that creates the imbalance where you don’t get a Super Bowl or lose a Super Bowl, but it’s definitely part of the equation when people make decisions,” Mr. Campo said.

Opponents of the measure played down any economic impact, describing the supporters’ claims as a fear tactic. Mr. Patrick minced no words about the threat of losing the Super Bowl. If Roger Goodell, the N.F.L. commissioner, “would even suggest that the Super Bowl not be played here because we don’t want men in ladies’ bathrooms, then we need a new commissioner,” Mr. Patrick said.

Both sides claimed to speak for the city. The main coalition of supporters was called Houston Unites, while the main one for opponents was Campaign for Houston. Houston Unites raised nearly $3 million, and Campaign for Houston more than $1 million. Supporters called the measure HERO, for Houston’s Equal Rights Ordinance, while opponents referred to it as the Bathroom Ordinance.