WASHINGTON — Congress voted Thursday to permanently bar state and local governments from taxing access to the Internet, as lawmakers leapt at an election-year chance to demonstrate their opposition to imposing levies on online service.

On a vote of 75-20, the Senate gave final congressional approval to the wide-ranging bill, which would also revamp trade laws. President Barack Obama is expected to sign it.

“The Internet is a resource used daily by Americans of all ages across our country,” said Senate Majority Leader Mitch McConnell, R-Ky., who brokered an agreement with a Democratic leader earlier this week that helped clear the way for passage. “It’s important that they be able to do all of this without the worry of their Internet access being taxed.

The ban on local Internet access taxes had broad support. Even so, some lawmakers remained unhappy over its trade provisions and because the measure omitted a separate, more controversial proposal to let states force online retailers to collect sales taxes for their transactions.

Senate Minority Leader Harry Reid, D-Nev., said the bill was full of “missed opportunities and half-measures.”

Since 1998, in the Internet’s early days, Congress has passed a series of bills temporarily prohibiting state and local governments from imposing the types of monthly levies for online access that are common for telephone service. Such legislation has been inspired by a popular sentiment that the Internet should be free, along with Republican opposition to most tax proposals.

Until now, states that imposed Internet access taxes have been allowed to continue. Under the bill before the Senate, those states would have to phase out their taxes by the summer of 2020.

Seven states — Hawaii, New Mexico, North Dakota, Ohio, South Dakota, Texas and Wisconsin — have been collecting a combined $563 million yearly from Internet access taxes, according to information gathered by the nonpartisan Congressional Research Service.

The House approved the compromise Internet and trade bill in December with the backing of nearly all Republicans but just 24 Democrats.

The White House did not immediately provide a statement on whether Obama would sign the measure despite wide expectations by lawmakers that he would. That seemed to reflect a difficult political balancing act between a popular ban on Internet access taxes and imposing trade provisions that many Democrats considered insufficient.

The legislation, especially its trade provisions, has pitted the U.S. Chamber of Commerce and other business groups supporting the bill against opponents including the AFL-CIO and other labor organizations.

Supporters say the measure would strengthen U.S. trading by improving protections for American intellectual property like copyrights and trademarks and upgrading trade law enforcement at the country’s borders.

They also cite provisions reinforcing the government’s ability to head off China and other countries from manipulating their currency to make their exports more affordable, cracking down on imported products made with child labor and accelerating investigations into companies accused of evading the payment of duties.

While some Democrats supported the bill, others complained that its trade protections were insufficient and said negotiators who wrote the compromise weakened it significantly, including the currency manipulation part.

Democrats also disliked provisions barring trade agreements that would curb some efforts to restrict greenhouse gas emissions, a major contributor to climate change, or would force the U.S. to revamp its immigration laws.

For years, the drive in Congress to permanently bar taxes on Internet service has languished alongside another effort to empower states to require online retailers to collect state and local sales taxes for online purchases. Supporters of enhancing the collection of sales taxes for online sales say without that, brick-and-mortar stores face a competitive disadvantage.

In hopes of gaining leverage, senators backing the collection of online state sales taxes have long linked the two efforts.

A breakthrough came this week when McConnell agreed to hold a vote this year on the online state sales tax proposal. He reached that deal with No. 2 Senate Democratic leader Richard Durbin of Illinois, a strong advocate of the separate Internet sales tax measure.

Even so, some lawmakers were upset that the sales tax measure would be considered later, with no guarantee of success.