The Senate vote was 62-36, with nine Republicans voting yes along with 53 Democrats, The New York Times reported. In the House, the measure was approved 241-180.
Obama issued a statement saying while he was "pleased that Congress took bipartisan action to provide funding for the communities in New York, New Jersey, and Connecticut, and other eastern states devastated by Hurricane Sandy," he "had hoped Congress would provide this aid sooner."
The storm hit the East Coast in late October, but the aid package got tangled up in partisan wrangling in Congress.
"For the families working to put their lives back together, every day without relief is one day too many," he said.
"My administration remains committed to supporting our state and local partners and bringing every resource to bear as we help our neighbors rebuild. And we will continue to work closely with governors and mayors to ensure this money is used appropriately.
"Brick by brick, block by block, our communities are being made whole again. And we will not rest until the job is done. Again, I commend Congress for giving families and businesses the help they deserve, and I will sign this bill into law as soon as it hits my desk."
The $51 billion is on top of nearly $10 billion Congress approved previously this month.