WASHINGTON -- Prodded by national anger at Wall Street, the Senate on Thursday passed the most far-reaching restraints on big banks since the Great Depression. In its broad sweep, the massive bill would touch Wall Street CEOs and first-time homebuyers, high-flying traders and small town lenders.

The 59-39 vote represents an important achievement for President Barack Obama, and comes just two months after his health care overhaul became law. The bill must now be reconciled with a House version that passed in December. A key House negotiator predicted the legislation would reach Obama's desk before the Fourth of July.

The legislation aims to prevent a recurrence of the near-meltdown of big Wall Street investment banks and the resulting costly bailouts. It calls for new ways to watch for risks in the financial system and makes it easier to liquidate large failing financial firms. It also writes new rules for complex securities blamed for helping precipitate the 2008 economic crisis, and it creates a new consumer protection agency.

It would impose new restraints on the largest, most interconnected banks and demand proof that borrowers could pay for the simplest of mortgages.

"Our goal is not to punish the banks but to protect the larger economy and the American people from the kind of upheavals that we've seen in the past few years," Obama said earlier Thursday after the Senate cleared a key 60-vote hurdle blocking final action.

The financial industry, Obama said, had tried to stop the new regulations "with hordes of lobbyists and millions of dollars in ads."

Only two Democrats, Sens. Maria Cantwell of Washington and Russ Feingold of Wisconsin, voted against the bill. Feingold said it did not go far enough to rein in Wall Street and end a culture of "too big to fail."

Four Republicans -- Sens. Charles Grassley of Iowa, Scott Brown of Massachusetts, and Olympia Snowe and Susan Collins of Maine -- broke ranks with their party to support it.

Twice the Senate had to beat back efforts by Republicans to delay the bill before achieving final passage.

"The decisions we've made will have an impact on the lives of Americans for decades to come," said Sen. Richard Shelby, R-Ala., who voted against the legislation. "Judgment will not be rendered by self-congratulatory press releases, but, rather, by the marketplace. And the marketplace does not give credit for good intentions."

While Republicans succeeded in amending the bill, they still objected to its sweep, claiming it represented an expansion of government power that would have unintended consequences.

Democrats argued it was a potent response to the financial abuses, regulatory weaknesses and consumer misjudgments that plunged the nation deep into recession.

"To Wall Street, it says: No longer can you recklessly gamble away other people's money," said Senate Majority Leader Harry Reid, D-Nev. "It says the days of too big to fail are behind us. It says to those who game the system: The game is over."

As House and Senate negotiators meet to work out differences in the bills, the common ground between the two bills will likely tilt toward making the bill tougher on banks rather than weaker. If anything, the political environment has grown more populist since the House passed its bill in December.

Unemployment still hovers around 10 percent, big banks have declared significant if not record profits, and Goldman Sachs is fighting off accusations of fraud from the Securities and Exchange Commission.

The end game was not without drama. Cantwell changed her vote to help move the bill along only to vote against it on final passage.

Republicans, meanwhile, abandoned a highly lobbied measure that would have excluded auto dealers from rules devised by a new consumer financial protection bureau.

The GOP move was tactical, designed to deny Democrats a vote on a measure that would have placed explicit restrictions on the ability of commercial banks to engage in high-risk, profit-making trades and impose conflict of interest rules on how investment banks market products to their clients.

Republicans will now seek a nonbinding vote on Monday to instruct House and Senate negotiators to exclude auto dealers from consumer regulations in the final bill. The House version already carves the dealers out of consumer agency oversight.

The bill's passage represented a triumph for Sen. Chris Dodd, the Connecticut Democrat who is retiring rather than face possible defeat in a re-election bid. For months, Dodd, the Banking Committee chairman, tried to forge a bipartisan agreement with Republicans. Wary Obama officials and Democrats urged him not to give too much. In the end, the talks failed.

Consumer advocates, who had pressed the Senate for even more regulations, nevertheless cheered the Senate vote and hailed the bill as a tougher companion to the House version.

For all its breadth, the bill stopped short of taking on the nation's giant mortgage companies, the government-affiliated Fannie Mae and Freddie Mac. Democrats feared that incorporating massive housing policy into the bill would have sunk it.

The two companies lowered their standards for borrowers during the housing boom and now those high-risk loans are defaulting at a record pace, prompting a $145 billion government rescue.

"Perhaps what is most disappointing about the lack of attention to Fannie and Freddie is the fact that there is no end in sight," Shelby said. "Losses continue to mount and taxpayer exposure is unlimited."

The Federal Reserve, once the object of scorn for failing to see the housing bubble, emerged fairly unscathed. It retained supervision over bank holding companies and state-chartered banks and would also oversee any large interconnected nonbank financial firm deemed a potential risk to the financial system. That addition, also in the House bill, aimed to prevent a company such as insurance conglomerate AIG from escaping tough regulation.

In a response to a public outcry over bank bonuses and multimillion-dollar compensation packages, the legislation also gives shareholders the right to cast nonbinding votes on executive pay packages. The Fed would set standards on excessive compensation that would be deemed an unsafe and unsound practice for the bank.