The disaster in 2010 spewed more than 200 million gallons of oil into the sea over three months.
BP also pleaded guilty to lying to Congress about the size of the spill from its broken well.
Neither the Justice Department nor BP presented arguments to the judge before her decision in New Orleans.
However, the energy firm's legal woes are far from over.
The company is due to return to court on February 25 for a trial involving scores of remaining lawsuits and could have to pay billions more in penalties for environmental damage.
The oil giant separately agreed to a settlement with lawyers for Gulf Coast residents and businesses who claim the spill cost them money. BP estimates that deal will cost the company $7.8bn (£4.9bn).
For the criminal settlement, BP agreed to pay nearly $1.3bn in fines. The largest previous corporate criminal penalty assessed by the Justice Department was a $1.2bn fine against drug maker Pfizer (NYSE: PFE - news) in 2009.
The criminal settlement also includes payments of nearly $2.4bn to the National Fish and Wildlife Foundation and $350m to the National Academy of Sciences.
Attorneys for BP and the Justice Department argued that the plea agreement imposes "severe corporate punishment" and will ensure BP and other deep-water drilling companies prevent another disaster from occurring.
The Justice Department has reached a separate settlement with rig owner Transocean that resolves the government's civil and criminal claims over the Swiss-based company's role in the disaster.
Transocean (NYSE: RIG - news) agreed to plead guilty to a misdemeanour charge of violating the Clean Water Act and pay $1.4bn in civil and criminal penalties. A February 14 hearing has been scheduled to decide whether to accept that criminal settlement.
Many relatives of rig workers killed in the blast submitted written statements that were critical of BP's deal.
The family of Gordon Jones, who died aged 28, said BP's sentence should include a face-to-face apology to his widow and children by BP executives.
Jones' brother also urged the judge to consider stiffer penalties that prohibit or limit the company's ability to operate in US waters.
But US District Judge Sarah Vance said she could not get involved in plea negotiations and only could impose a sentence that adheres to the terms.
More From Sky News