The senate voted 62-36 on Thursday for the bipartisan bill that couples border security and enforcement with a guest-worker programme that would put most of the 11 million to 12 million illegal immigrants on a path to US citizenship.
It is the most sweeping immigration bill in 20 years and senate legislation has to be merged with a vastly different House bill that calls for tough border security and enforcement measures.
George Bush, the US president, has said he supports a comprehensive approach to immigration reform along the lines passed by the senate, but lawmakers acknowledged that they still had more work to do.
"This product isn't perfect," said Bill Frist, a Tennessee Republican and senate majority leader. "Much more refinement needs to be done."
Many politicians say Bush will have to become more involved in the bargaining for a final bill to be agreed upon before congressional elections in November. Recent polls show growing public dissatisfaction with the Republican majority.
The House bill became the focus of massive protests this spring across the country by mainly Hispanic immigrants seeking the right to remain and work in the US.
Bush is mindful of the growing clout of Hispanic voters and has long pushed for immigration reform and a guest-worker programme. But the issue divides Republicans and some senate opponents said they would seek to rewrite the legislation during negotiations with the House.
They oppose provisions giving millions of illegal immigrants a chance to become US citizens. They also oppose a provision that would eventually allow some temporary workers to seek permanent status and citizenship.
"I am hopeful the House will save us from this bill," said John Ensign, a Republican senator from Nevada.
Supporters say they are optimistic.
"Some say the easy part of this debate is over, and now we face the hard part - reconciling the senate bill with the House bill," said Edward Kennedy, a Democrat senator from Massachusetts who helped shepherd the bill through the senate. "We'll do our best and I'm optimistic we can resolve our differences."
Politicians acknowledged that negotiations will be difficult.
John Boehner, a Republican from Ohio and the house majority leader, said: "The senate has provisions that go far beyond [the House bill] and I don't underestimate the difficulties of the House and senate trying to come together."