President Obama tonight thanked the leaders of both parties in the Senate for passing a deal to reopen the government and avert default, and said he will sign the bill "immediately."

"I want to thank the leaders of both parties for getting us to this point. Once this agreement arrives on my desk, I will sign it immediately. We will begin reopening our government immediately," he told reporters in the White House briefing room. "And we can begin to lift this cloud of uncertainty and unease from our businesses and from the American people."

Congress Passes Deal on Shutdown, Debt Scare

LIVE UPDATES: Deal to End Shutdown

FULL COVERAGE: Government Shutdown

The president spoke shortly after the Senate overwhelmingly passed the bill negotiated by the Republican and Democratic leaders, but before the House voted.

With an economic crisis averted and the government on track to reopen, the president said it's time to "earn back the trust of the American people that has been lost over the last few weeks."

"We can begin to do that by addressing the real issues that they care about," he said. "I've said it before, I'll say it again: I am willing to work with anybody, I am eager to work with anybody - Democrat or Republican, House or Senate members - on any idea that will grow our economy, create new jobs, strengthen the middle class and get our fiscal house in order for the long term. I've never believed that Democrats have a monopoly on good ideas."

The president said he hoped the 16-day government shutdown and political brinkmanship over the raising debt limit will be a learning experience for Washington.

"Hopefully, next time, it won't be in the 11th hour," he said, cautioning about future budget negotiations. "One of the things that I said throughout this process is we've got to get out of the habit of governing by crisis. And my hope and expectation is everybody has learned that there is no reason why we can't work on the issues at hand, why we can't disagree between the parties while still being agreeable, and make sure that we're not inflicting harm on the American people when we do have disagreements.

"Hopefully, that's a lesson that will be internalized, not just by me but also by Democrats and Republicans, not only the leaders but also the rank and file," he added.

Lawmakers will soon be able to prove whether that lesson has been learned; the bill's timeline sets up yet another budget showdown early next year.

"Isn't this going to happen all over again in a few months?" a reporter asked, as Obama walked out of the briefing room.

The president turned at the door, smiled, and said firmly, "no."