Judge Ralph Beistline also lifted BP Exploration (Alaska) Inc.'s probation altogether.
BP had been convicted of negligent discharge of oil in 2007 for a 200,000-gallon spill on the North Slope a year earlier. There was another spill of 13,500 gallons in 2009.
Last month, government lawyers sought to have BP's probation revoked for the latest spill, meaning the probation period could have been lengthened or the company could have faced additional penalties.
In his ruling, Beistline said the government failed to prove the company committed criminal negligence.
"We are pleased with the decision and appreciate the court's attention," BP spokesman Steve Rinehart said in an email to The Associated Press. "We know that the privilege of working in Alaska comes with a responsibility to maintain high standards. We will continue our commitment to running safe and compliant operations."
Emails seeking comment from the U.S. attorney's office in Anchorage were not immediately returned.
Prosecutors said BP's history of environmental crimes in Alaska began in February 2001 when it pleaded guilty to releasing hazardous materials at its Endicott facility on the North Slope. The company was fined $500,000, placed on probation for five years and ordered to create a nationwide environmental management program, prosecutors said.
The March 2006 spill of 200,000 gallons of crude was caused by corrosion, and BP's leak detection system failed to notice it, they said.
The company's guilty plea to a misdemeanor violation of the Clean Water Act in 2007 resulted in three years' probation, a $12 million fine, and restitution and community service payments totaling $8 million to the state of Alaska and the National Fish and Wildlife Foundation.
Prosecutors contended BP violated the conditions of its probation by allowing the 2009 spill from an 18-inch pipe that moved oil, water and gas from drill pads to BP's Lisburne Processing Center. That spill, prosecutors said, leaked 13,500 gallons of oil onto tundra and wetlands.
The government said it was similar to the 2006 spill because BP ignored alarms that warned of the pipe's eventual rupture and leak. The 2009 spill also came after a similar pipe froze and ruptured in 2001, they said, and BP failed to put in place preventative measures that their own experts recommended.
But in his ruling, Beistline wrote: "The investigation concluded, based on the metallurgy report, that the pipeline rupture was not caused by corrosion or improper maintenance, but was caused by a sequence of circumstances, including cooling and warming of ambient temperature after the flow stopped, which led to the freezing of both water and hydrates. This ultimately resulted in increased gas pressure within the pipeline that caused the rupture. Why the flow slowed initially remains a mystery to all."
Beistline said BP followed "accepted industry practices at all relevant times and could not have reasonably expected a blowout similar to the one that occurred on November 29, 2009. Further, the court concludes that once the freeze up was discovered, BP acted reasonably in addressing the problem."
He also said BP's efforts to return the spill site to pre-spill conditions were "impressive."
"An untrained observer would likely be unable to find any indication that a spill had occurred," he wrote, adding there was no evidence that contaminants reached any nearby lakes or Prudhoe Bay.