BP has been complaining for most of the past year that its fund for compensating economic victims of the 2010 Gulf of Mexico oil spill was out of control, and that a New Orleans court official was approving payments to people who had not been affected at all by the disaster.

On Wednesday night, an appeals court agreed in a ruling that could help cap the gusher of payments under one portion of BP’s multi-front legal effort to put the spill behind it. The company’s stock rose Thursday in response to the long-sought decision, which sent the matter back to a federal district court judge in New Orleans with new instructions.

On a down day for stock markets, BP shares closed up 28 cents, at $42.39, after the U.S. Court of Appeals for the 5th Circuit ruled 2 to 1 that the district court had exceeded its power by “allowing recovery from the settlement fund by those who have no case and cannot state a claim.”

“It’s a ray of hope,” said Fadel Gheit, an oil analyst with Oppenheimer & Co. “Hopefully, it will change the momentum and reverse their misfortune.”

BP has lost about a third of its value since the April 2010 blowout at its Macondo well killed 11 people and spilled millions of barrels of oil into the Gulf of Mexico.

BP, which had initially estimated the cost of a March 2012 settlement with thousands of private plaintiffs along the Gulf Coast would be about $7.8 billion, has alleged that many of the people seeking compensation actually suffered no harm from the spill. It later warned investors that improper claims could inflate the size of that settlement by billions of dollars if the court-appointed administrator continued to approve them.

Over the past three years, BP has sought to quickly settle cases. It set aside about $42 billion for cleanup, fines and compensation it expected to pay for the spill.

In recent months, however, BP has taken a tougher stand toward settlements.

In this case, it risks antagonizing Carl J. Barbier, the New Orleans district court judge who was overruled and who had appointed and defended the court administrator. Barbier is also presiding over a separate case in which the federal government is seeking $17 billion or more in Clean Water Act penalties from the London-based oil giant. Settlement talks with the Justice Department in that case broke down this year.

The appeals court ordered Barbier to issue an injunction to allow time for “deliberate consideration” of issues BP had raised about economic claims. He had declined to issue such a directive earlier. The appeals court said that “the district court had no authority to approve the settlement of a class that included members that had not sustained losses at all, or had sustained losses unrelated to the oil spill, as BP alleges.”

In their majority decision, Judges Edith Clement and Leslie Southwick said that the settlement administrator’s interpretation of accounting terms were “completely disconnected from any reasonable understanding of calculation of damages.”

“This is certainly a helpful decision,” said Pavel Molchanov, an oil analyst at the investment firm Raymond James. “BP has been struggling with what it claims is fraud and abuse in Gulf Coast claims process.” Now, he said, “there will presumably be greater judicial oversight of these claims.”

BP has been running ads criticizing the plaintiffs and the district court.

“BP is extremely pleased with today’s ruling,” BP spokesman Geoff Morrell said in a statement Wednesday night after the appeals court’s ruling was issued. “Today’s ruling affirms what BP has been saying since the beginning: claimants should not be paid for fictitious or wholly non-existent ­losses. We are gratified that the systematic payment of such claims by the claims administrator must now come to an end.”

Steve Herman and Jim Roy, lead attorneys for the plaintiffs’ steering committee, issued a joint statement.

“We’re pleased that the vast majority of class members will continue to be paid in a timely and expeditious manner,” they said via e-mail. “We look forward to working with the Claims Administrator and the Court to determine the best way to get the affected claims processed and paid as soon as possible.”

But analysts said that the ruling would make a difference. It was a “significant positive” for the company, Susquehanna analyst Tom Claps wrote in note to investors. He said that the “overwhelming consensus” among investors had been that BP would lose its appeal and that it could result in $4 billion to $5 billion in additional payments.

“In aftermath of Macondo, BP was eager to settle as quickly as possible,” Molchanov said. “It was a blank check BP decided to pay. When the company figured out just how blank that check was, it made some attempts to backtrack on that.”