Reactions of relief came swiftly. Senator John McCain, a Republican who had urged the governor to veto the legislation, said in a statement, “I hope that we can now move on from this controversy and assure the American people that everyone is welcome to live, work and enjoy our beautiful state of Arizona.”

Hour by hour, the state began to lose business even as the governor deliberated: The Hispanic National Bar Association said Wednesday that it had canceled plans to hold its annual convention of 2,000 lawyers here next year, citing the bill and saying in a statement, “It is imperative that we speak up and take immediate action in the presence of injustice.”

Image Arizona business leaders had warned that the bill would be a financial disaster for the state and harm its reputation. Credit... Matt York/Associated Press

The National Football League, which is planning to hold the Super Bowl here next year, started actively exploring other options in case Ms. Brewer signed the bill.

Outside the Capitol, protesters gathered in the shade of a palm tree holding signs that read, “Civil rights trump religious wrongs.” Inside, television cameras stood guard by the entrance to the governor’s wing as volunteers from the Human Rights Campaign, a national gay rights group, hauled in boxes of petitions holding 63,000 signatures asking for a veto.

The measure is the latest initiative in Arizona to set off a political firestorm. Arizona is still struggling to repair its image and finances after the boycotts and bad publicity it endured after the passage of an immigration law in 2010 that gave police officers the right to stop people whom they suspected of being in the country illegally and made it a crime for illegal immigrants to hold jobs.

The state also faced a boycott almost 20 years ago, after voters initially refused to recognize Martin Luther King’s Birthday as a state holiday. At that time, the state was also set to host the Super Bowl, but the N.F.L., looking to avoid controversy, moved the game to Pasadena, Calif.