Tesco has agreed to pay a fine of £129m to avoid prosecution for overstating its profits in 2014.
Its subsidiary, Tesco Stores Ltd, reached what's known as a deferred prosecution agreement with the Serious Fraud Office after a two-year probe.
Tesco said there was "regret" over the issues of 2014 and said it has been working hard to "restore trust".
The firm also agreed with the Financial Conduct Authority (FCA) to spend £85m on compensating investors.
The money will go to those who bought shares or bonds between 29 August and 19 September in 2014.
Those investors would have had misleading information from a trading statement on 29 August, which gave a rosier assessment of its performance than was actually the case.
Tesco issued a corrected statement before the markets opened on Monday 22 September, which estimated it had overstated profits by about £250m.
The revelation sent the retailer's share price plunging and sparked two internal inquiries.
Even that was not the full story, the overstatement was subsequently revised up to £326m.
The compensation order is a first for the FCA, although it has not imposed its own penalty, and Tesco has accepted the regulator's finding of "market abuse".
The SFO said Tesco had co-operated with the investigation and had undergone an "extensive" period of change.
Tesco's current chief executive, Dave Lewis, said: "Over the last two-and-a-half years, we have fully co-operated with this investigation into historic accounting practices, while at the same time fundamentally transforming our business.
"We sincerely regret the issues which occurred in 2014 and we are committed to doing everything we can to continue to restore trust in our business and brand."
Analysis, Simon Jack, business editor
A Deferred Prosecution Agreement (DPA) is a fairly new way (introduced in February 2014) of punishing a company for criminal behaviour without the collateral damage of a conviction.
DPAs may be fairly new, but they are instruments the SFO is warming to. Just last month it announced a DPA with Rolls-Royce which saw the company pay a UK fine of £500m. In that case, the judge agreed that a criminal conviction for the company could disbar it from securing contracts - particularly in the US - which in turn could threaten the jobs of thousands of UK workers.
A DPA also avoids lengthy and costly trials and puts the offending company on probation to ensure full co-operation in the future.
It also does NOT mean that individuals escape scot free while shareholders pay the price for their conduct. Three former executives from Tesco face criminal proceedings. The SFO also quizzed the former chief executive Phil Clarke, before dropping any further action against him.
The DPA with Tesco Stores still needs approval by the High Court, which is scheduled to make its decision on 10 April.
This potential DPA agreement only covers Tesco Stores and does not address whether liability of any sort applies to the larger international group Tesco plc or any of its employees.
To pay for the penalty, compensation scheme and related costs Tesco will charge £235m to its results for the 2016-17 financial year, which are due to be published on 12 April.
Tesco shares were little moved on Tuesday.
Laith Khalaf, senior analyst, at Hargreaves Lansdown stockbrokers, said the accounting error uncovered was "exceptionally rare" in the UK stock market.
"This is a big slap on the wrist for Tesco, reflecting the seriousness of the offence and its impact on the share price in 2014," he said.
"Dave Lewis underwent a baptism of fire when he took over as CEO in 2014, just as the accounting scandal struck. He and the supermarket will now be hoping to draw a line under the matter, and concentrate on nurturing Tesco's nascent recovery.
Analysis, Ian Pollock, personal finance reporter
The Tesco scandal contains a real novelty. It is a compensation scheme for about 10,000 professional and personal investors.
They bought shares or bonds at artificially inflated values after the supermarket group put out its misleading trading statement on 29 August 2014. They suffered a loss if they were still holding those investments, when their values fell, after a correction from the company was issued a few weeks later on 22 September.
To qualify, you have to be a so-called "net purchaser" - someone who during that period bought more shares or bonds than they sold.
The compensation is 24.5p per share, plus interest. Various values, plus interest, are on offer to bond holders.
The compensation scheme will be run by the accountancy firm KPMG, and should start before the end of August this year.
KPMG will try to contact all eligible claimants. If you are one of them you will need to provide evidence of your purchases and any sales.
You will have six months to lodge a claim.