New Land rights law squeezes through
The native title bill limits Aboriginal rights to their ancestral land, which is owned by the government and leased to farmers and miners.
Senators passed the law by 35-33 after the longest debate in Australian parliamentary history.
Land at stake included the famous Bondi beach and areas surrounding the Australian parliament.
Independent Senator Brian Harradine swung the vote in favour of the bill after he struck a compromise deal with the Prime Minister John Howard.
Mr Harradine said: "Sticking points have been resolved now in a manner which upholds the native title rights of indigenous people."
Mr Howard had threatened to dissolve parliament if the bill failed to make it onto the statute books, raising the spectre of an election with race as the central issue.
Such an election could have handed the balance of power to Pauline Hanson and her One Nation party which has an anti-immigration manifesto.
The legislation will reverse some land rights that the High Court ruled Aborigines were entitled to in a case brought by the Wik people in 1996.
The government has promised to meet 75% of the cost of compensation to native title holders who lose their rights because of changed land use. The states will pay the remaining 25%.
The Wik ruling on December 23, 1996, allowed Australia's 390,000 Aborigines to claim their native right to use land under pastoral or mining leases.
It was bitterly opposed by farmers and mining companies who said it would destroy businesses. It also led to hundreds of claims, many disputed as bogus.
Aboriginal access is typically the right to cross the land, to hunt on it and to visit sacred places.
After five years of intense and increasingly complex debate the vote was always on a knife-edge.
The Labour opposition and government agreed that some new legislation was needed to regulate native title.
But the opposition said the government was going too far in protecting farmers from Aboriginal claims.
A BBC correspondent in Sydney says the issue has been "extraordinarily sensitive" because politicians did not want to be seen advocating a racist line but equally anyone who speaks critically of Aborigines can expect to be denounced as racist.
In Australia race is rising up the political agenda. The controversial right wing One Nation party won seats in the Queensland parliament with more than 20% support from voters.Mrs Hanson, once voted the country's most despised politician, opposes immigration into Australia and wants to stop special funding for Aborigines.
Aborigines camped outside Parliament House in Canberra to protest against the bill.
Some flew Aboriginal flags at half-mast and the government was accused of "sharpening their spears" against Aborigines.
Aborigines say the new law is a racist "modern-day dispossession" of their rights and land and they are expected to challenge it in the courts.
Farmers and miners say the bill gives them more certainty over their leases and their commercial operations, worth A$65 billion (US$40 billion) a year in exports.