The Senate sided with traditional retailers and financially strapped state and local governments by passing the bill by a vote of 69 to 27, getting support from Republicans and Democrats alike.
The measure empowers states to require businesses with more than $1 million in out-of-state sales to collect taxes for products they sell on the Internet, along with sales from catalogs and through radio and TV ads.
Under the current law, states can only require retailers to collect sales taxes if the store has a physical presence in the state. As a result, many online retailers like eBay and Amazon don't have to collect sales taxes, except in states where they have offices or distribution centers.
California already has a law requiring online merchants to collect a sales tax on purchases made by in-state residents.
The bill faces opposition from some lawmakers in the House who regard it as a tax increase. President Barack Obama has expressed his support for the measure.
Internet giant eBay is leading the fight against the bill, along with lawmakers from states with no sales tax and several prominent anti-tax groups. EBay wants to exempt businesses with up to $10 million in sales or less than 50 employees.
According to government estimates, Internet sales in the U.S. in 2012 totaled $226 billion, up nearly 16 percent from 2011.
According to a study done for the National Conference of State Legislatures, which has lobbied for the bill, states lost a total of $23 billion last year because they couldn't collect taxes on out-of-state sales.
The Associated Press contributed to this report.