The Arizona Legislature adopted a major overhaul of the state’s complicated sales tax collection system in the final hours of the session Thursday night after a deal with cities and towns removed a major roadblock.

Municipalities led by the League of Arizona Cities and Towns were able to hold off the overhaul after raising concerns they would lose revenue. Gov. Jan Brewer made the overhaul a priority of the legislative session and made major compromises before the final deal was struck Thursday.

The Senate passed House Bill 2111 unanimously and the House passed it with just one opposing vote.

The overhaul would not impact what ordinary consumers pay at store checkouts. Instead, it will make it easier for businesses that pay a so-called Transaction Privilege Tax. The deal leaves in place a tax on new construction that funds many city projects but eliminates it for companies that do home and other repairs.

Municipalities could still lose revenue, but the compromise gives them better ways to track revenue and clarifies how audits are done, said the sponsor, Rep. Debbie Lesko, R-Peoria. The deal that was finally cut Thursday happened after months of impasse.

“The League came to the table and gave us some reasonable language about what they wanted,” Lesko said.

The deal came together as the Legislature pushed out a budget and Brewer’s Medicaid expansion plan and made a rush to finish work and adjourn Thursday night.

The overhaul targets the state’s complex system where businesses are taxed on their revenues, at different rates by different entities, including the cities, counties and the state. The tax on contractors and other business transactions known as the TPT, and the state alone is estimated to collect $3.8 billion of the state’s total revenue of $8.6 billion this budget year. Businesses also were subject to multiple audits and had to file returns in every city, county and town where they operated.

That system will be eliminated, with the state overseeing all those functions.