Ireland should recover up to €13bn (£11bn) from Apple in back taxes, the European Commission has ruled.
After a three-year investigation, it has concluded that the US firm's Irish tax benefits are illegal.
The Commission said Ireland enabled the company to pay substantially less than other businesses, in effect paying a corporate tax rate of no more than 1%.
Ireland and Apple both said they disagreed with the record penalty and would appeal against it.
"Member states cannot give tax benefits to selected companies - this is illegal under EU state aid rules," said Commissioner Margrethe Vestager.
"The Commission's investigation concluded that Ireland granted illegal tax benefits to Apple, which enabled it to pay substantially less tax than other businesses over many years," she added.
The standard rate of Irish corporate tax is 12.5%. The Commissions's investigation concluded that Apple had effectively paid 1% tax on its European profits in 2003 and about 0.005% in 2014.
Ms Vestager said that the tax agreement reached between Ireland and Apple meant that the company's taxable profits "did not correspond to economic reality".
'Profound and harmful effect'
Apple said the decision would be harmful for jobs.
"The European Commission has launched an effort to rewrite Apple's history in Europe, ignore Ireland's tax laws and upend the international tax system in the process," the company said in a statement.
"The Commission's case is not about how much Apple pays in taxes, it's about which government collects the money. It will have a profound and harmful effect on investment and job creation in Europe.
"Apple follows the law and pays all of the taxes we owe wherever we operate. We will appeal and we are confident the decision will be overturned."
The Irish government held a similar view.
"I disagree profoundly with the Commission," said Ireland's finance minister, Michael Noonan, in a statement.
"The decision leaves me with no choice but to seek cabinet approval to appeal. This is necessary to defend the integrity of our tax system; to provide tax certainty to business; and to challenge the encroachment of EU state aid rules into the sovereign member state competence of taxation."
The record tax bill should not be a problem for Apple, which made a net profit of $53bn in the 2015 financial year.
"Apple has been enjoying a river of free cash flow and while the ruling may not been too much short-term, investors will have to assess whether a higher tax bill will have any impact on profits after tax," said Neil Wilson, market analyst at ETX Capital.
The US Treasury, which said last week that the European Commission was in danger of becoming a "supranational tax authority", said the latest ruling could "undermine foreign investment, the business climate in Europe, and the important spirit of economic partnership between the US and the EU".
"We will continue to monitor these cases as they progress, and we will continue to work with the Commission toward our shared objective of preventing the erosion of our corporate tax bases," a US Treasury spokesman said.
Apple is not the only company that has been targeted for securing favourable tax deals in the European Union.
Last year, the commission told the Netherlands to recover as much as €30m (£25.6m) from Starbucks, while Luxembourg was ordered to claw back a similar amount from Fiat.
Analysis: Dominic O'Connell, Today business presenter
The current focus is on the size of the bill, but there are even larger issues at stake, including one fundamental question - who really runs the world, governments or giant corporations?
At present, it is difficult to tell. Individual governments appear impotent in their attempts to apply their tax laws to multinationals like Apple. They have systems designed to deal with the movement and sale of physical goods, systems that are useless when companies derive their profits from the sale of services and the exploitation of intellectual property.
In Apple's case, 90% of its foreign profits are legally channelled to Ireland, and then to subsidiaries which have no tax residence. At the same time, countries can scarcely afford not to co-operate when Apple comes calling; it has a stock market value of $600bn, and the attraction of the jobs it can create and the extra inward investment its favours can bring are too much for most politicians to resist.
There is an echo here of the tycoons of the early 20th Century who bestrode America. Andrew Carnegie, Cornelius Vanderbilt and John Rockefeller were judged so powerful that they were almost above the law, something that successive US administrations sought to curb.
The European Commission's attempt to bring Apple to heel is on the surface about tax, but in the end about the power of the multinational and the power of the state. There is more to come; Margrethe Vestager, the Danish commissioner who is leading the charge against Apple, is warming up to take on Google.
Europe versus the giants of corporate America will be a battle royale, and one that will run and run.