WASHINGTON - President Barack Obama declared victory Friday after congressional negotiators worked all night before agreeing to a sweeping overhaul of the way Wall Street does business.

Lawmakers shook hands on the compromise legislation at 5:39 a.m. EDT (0939GMT) after Obama administration officials helped broker a deal that cracked the last impediment to the bill, a proposal to force banks to spin off their lucrative derivatives trading business.

The agreement now must go to the full Senate and House of Representatives for final votes and was expected to be on Obama's desk for signing before the U.S. July 4 holiday marking American independence from Britain.

The measure would be the second major legislative triumph for a president who has seen his favourable rating drop as the country watches oil continue to gush into the Gulf of Mexico more than two months after a BP well blew out on the ocean bottom.

That, combined with a very difficult economy, high unemployment and worries about the U.S. war effort in Afghanistan, has hit hard against Obama and his Democratic majorities in Congress just four months ahead of congressional elections.

Speaking to reporters as he left the White House to attend an economic summit of world leaders in Toronto, Canada, the president said he was gratified for Congress' work and said the deal included 90 per cent of what he had proposed. He said the bill, forged in the aftermath of the 2008 financial meltdown, represents the toughest financial overhaul since the Great Depression of the 1930s.

"We've all seen what happens when there is inadequate oversight and insufficient transparency on Wall Street," Obama said. "The reforms working their way through Congress will hold Wall Street accountable so we can help prevent another financial crisis like the one that we're still recovering from."

Congress' expected final passage of the measure will give Obama an extra tool in his meetings in Toronto, where many of the assembled leaders have been critical of the U.S. financial system. They largely blame the United States for the worldwide spread of the economic slowdown gripping the globe.

Asked by reporters whether he can get the financial measure through the Senate, Obama said, "You bet." With the new health care law, passage of the legislation would give Obama a second major triumph that he and Democrats can take to voters as they head toward a tough election in November. Senate Democrats are trying to coalesce around the third big-ticket item on Obama's domestic agenda, passage of clean energy legislation.

He said he will discuss the regulations with other leaders at the Toronto meeting because the recent economic crisis proves that the world's economies are linked.

The legislation touches on an exhaustive range of financial transactions, from a debit card swipe at a supermarket to the most complex securities deals cut in downtown Manhattan.

Lawmakers hope the House of Representatives and Senate will approve the compromise legislation even though Republicans complained the bill overreached and tackled financial issues that were not responsible for the financial crisis.

The legislation would set up a warning system for financial risks, would create a powerful consumer financial protection bureau to police lending, would force large failing firms to liquidate and would set new rules for financial instruments that have been largely unregulated until now.

"It took a crisis to bring us to the point where we could actually get this job done," Senate Banking Committee Chairman Christopher Dodd said.

In its breadth, the legislation would affect working class home buyers negotiating their first mortgage as well as international finance ministers negotiating international regulatory regimes.

The bill came together during a time of high unemployment for American workers, huge bonuses for bankers and rising antipathy toward bank bailouts.

"It is reassuring to know that when public opinion gets engaged it will win," said Rep. Barney Frank, the Democratic chairman of the House-Senate panel that merged House and Senate bills into one piece of legislation.

House negotiators voted a party line 20-11 in favour of the final agreement; senators voted 7-5, also along party lines.