BHP received amended assessments for A$661 million for financial years 2003-08 for tax payable as a result of the sale of Australian commodities to the company's marketing arm in Singapore.
BHP disputed the assessments, but already paid $328 million.
The miner has agreed to pay $529 million in additional taxes for the income years 2003 to 2018.
In addition, BHP's Australian arm will increase its ownership of the marketing arm from 58% to 100%, meaning all profits made in Singapore in relation to Australian assets will be subject to Australian tax.
The company said it would provide certainty for both parties over the taxation treatment of the marketing business in future years.
The settlement fully resolves the dispute with no admission of tax avoidance by BHP.
BHP chief financial officer Peter Beaven said it was an important agreement and the company was pleased to resolve the long-running dispute.
"The $529 million payable under the settlement is in addition to the more than $75 billion in Australian taxes and royalties that have already been paid by BHP over that same period," he said.
Beaven said the settlement provided clarity over future tax assessments, which provided certainty for business and for Australia.
ATO Deputy Commissioner Jeremy Hirschhorn said this is an important development in the ATO's marketing hub strategy.
"While confidentiality provisions prevent us from commenting on specific details of the settlement, we are confident that a fair and reasonable outcome has been achieved for the Australian community," he said.
Hirschhorn said BHP would now come within the ATO's "green zone" for marketing hubs.
"This is a landmark and precedential development in the execution of our marketing hubs strategy, and sends a strong signal to other industry participants," he said.
"Given the importance of mining and natural resources to the Australian economy, it is critical that exporters of Australian commodities, whether iron ore, coal, gas or other commodities, pay the correct tax in Australia on their profits.
"The ATO has had a significant focus on marketing hub arrangements to ensure profits generated in Australia, are taxed in Australia."
The ATO published a guidance note last year, laying out its approach to marketing hubs.