The White House and the US Senate have reached a deal on an immigration bill that could give legal status to many of the 12m illegal immigrants in the US.
The immigration debate has sparked protests across the US
The agreement was announced by the Democratic Party's negotiator on the issue, Senator Edward Kennedy.
President George W Bush endorsed the deal, which also strengthens border controls, as a "much needed solution".
The proposal needs to be passed by both houses of Congress and formally signed by Mr Bush to become law.
It comes after months of bitterly fought debate over the issue.
Mr Bush said the deal offered a system that was "secure, productive, orderly and fair".
"With this bipartisan agreement, I am confident leaders in Washington can have a serious, civil and conclusive debate so I can sign comprehensive reform into law this year," he said in a statement.
After first paying visa fees and a $5,000 (£2,530) fine - and returning to their home country - illegal immigrants in the US would be eligible for the planned "Z visa".
Holders of this proposed visa would have to wait between eight and 13 years for a decision on their permanent residency application.
Another key component of the deal was the establishment of a "points system" that would emphasise new immigrants' education, language and job skills over family connections in awarding green cards.
New limits would also apply to US citizens bringing foreign-born parents into the country.
The bill also establishes a two-year temporary guest worker visa.
Holders of this visa would be allowed to renew their papers twice, but would have to return home for a year between each stint, and would have virtually no chance of gaining permanent residency or citizenship under this program.
But these measures would not come into force until the number of border guards had been doubled, the fence with Mexico reinforced and high-tech enforcement measures put in place.
"The agreement we just reached is the best possible chance we will have in years to secure our borders and bring millions of people out of the shadows and into the sunshine of America," Mr Kennedy said as he announced the deal.
The bill is expected to cause passionate debate in the Senate next week.
And in the House of Representatives Mr Bush is likely to have quite a fight on his hands, says the BBC's James Coomarasamy in Washington.
Immigration reform has been one of Mr Bush's top priorities in government, after the so-called "war on terror".
Many potential immigrants die on the perilous border crossing - often due to extreme thirst, although the threat of vigilante attacks is also rising.
President Bush has said he wants to see new legislation in place by the end of this year.
Analysts say the issue could stall if it drags on into 2008, when attention will turn to presidential elections.