The majority opinion written by Chief Justice John Roberts, who was appointed to the court by President George W. Bush, said the law is unconstitutional as applied to issue ads that a Wisconsin anti-abortion group wanted to broadcast before the 2004 election.
The ruling was a victory for the group Wisconsin Right to Life, which argued the law violated its free-speech rights under the First Amendment to the Constitution.
"The First Amendment requires us to err on the side of protecting political speech rather than suppressing it," Roberts wrote. "Where the First Amendment is implicated, the tie goes to the speaker, not the censor."
The court upheld a ruling that the ads were not election ads covered by the law, but were general issue ads that did not aim to influence voters.
The court's four liberals dissented and said campaign finance reform laws seek to protect the integrity of elections from huge amounts of money.
"After today, the ban on contributions by corporations and unions and the limitation on their corrosive spending when they enter the political arena are open to easy circumvention," Justice David Souter said for the dissenters.
The part of the law at issue in the ruling bans corporations, unions and special interest groups from using unrestricted money to run television or radio ads that refer to a candidate for federal office two months before a general election or one month before a primary election.
In 2003, the Supreme Court by a 5-4 vote upheld the law, including the ban on certain issue ads broadcast before an election.
But since then, Justice Sandra Day O'Connor, who cast the decisive vote in 2003, has retired and has been replaced by the more conservative Justice Samuel Alito, Bush's other appointee to the court, who joined the majority opinion.
The ads criticized Sen. Russell Feingold of Wisconsin for supporting efforts to block confirmation of several of Bush's judicial nominees. Because Feingold, a Democrat, was running for re-election at the time, the ads were prohibited.
Feingold had co-written the landmark campaign finance law, along with Sen. John McCain, an Arizona Republican who is running for president.
McCain called it regrettable that the court carved out a narrow exception by which some corporate and labor expenditures can be used to target a federal candidate in the days and weeks before an election.
"It is important to recognize, however, that the court's decision does not affect the principal provision of the (law), which bans federal officeholders from soliciting soft money contributions for their parties to spend on their campaigns," he said.
One of McCain's Republican presidential rivals, former Massachusetts Gov. Mitt Romney, hailed the ruling "Score one for free speech," he said.