(Reuters) - BP Plc. will face a maximum fine of $13.7 billion under the Clean Water Act for its Gulf of Mexico oil spill, several billion dollars less than feared, after a judge ruled that it was smaller than the U.S. government claimed.

The ruling by federal magistrate Carl Barbier put the size of the worst offshore spill in U.S. history in 2010 at 3.19 million barrels.

That was well below the government's estimate of 4.09 million barrels, which could have led to penalties of up to $17.6 billion.

BP's stock rose 2.4 percent in London by 0920 GMT on Friday, outperforming the broader energy index, as investors worried about the size of potential penalties breathed a sigh of relief.

"The ruling is a step in the right direction of what appears set to be a long and hard-fought legal battle," Barclays said in a research note.

Under a "gross negligence" ruling Barbier issued in September, BP could be fined a statutory limit of up to $4,300 for each barrel spilled, though he has authority to assign lower penalties.

A simple "negligence" ruling, which BP sought, caps the maximum fine at $1,100 per barrel.

The Clean Water Act penalties would come on top of more than $42 billion the oil major has set aside or spent for clean-up, compensation and fines. About 810,000 barrels were collected during clean-up.

In his ruling on Thursday, Barbier said BP's response to the disaster was not grossly negligent, but stuck to his earlier opinion that it had been grossly negligent leading up to the Macondo well blowout.

Penalties will be assigned after the third and final phase of the company's non-jury trial, which starts on Tuesday in New Orleans. BP lawyers are expected to argue for a small fine per barrel.

"BP believes that considering all the statutory penalty factors together weighs in favor of a penalty at the lower end of the statutory range," a BP spokesman said.

The first two phases of the trial, over the degree of negligence and the size of the spill, have concluded.

Even after the Clean Water Act fines are set, BP may face other bills from a lengthy Natural Resources Damage Assessment -- which could require BP to carry out or fund environmental restoration work in the Gulf -- as well as other claims.