By David Shepardson

WASHINGTON (Reuters) - Volkswagen AG <VOWG_p.DE> has agreed to spend more than $1.2 billion to compensate its 650 U.S. dealers for their losses from the German automaker's diesel emissions scandal, two sources briefed on the matter said on Thursday.

The company and a lawyer for the VW brand dealers announced a tentative settlement at a court hearing in San Francisco on Thursday, but declined to disclose the amount. The settlement, which followed talks that began in May, came as a judge ordered VW to move quickly to decide whether to fix or buy back 85,000 luxury vehicles with polluting engines.

The settlement includes about $1.2 billion in payments for the reduction in value of VW dealerships, and additional payments for vehicles that could not be sold, the sources briefed on the settlement said. VW has also agreed to continue to make certain incentive payments to dealers, the sources said.

"We believe this agreement in principle with Volkswagen dealers is a very important step in our commitment to making things right for all our stakeholders in the United States,” said Hinrich J. Woebcken, chief executive of VW's North American Region. "Our dealers are our partners and we value their ongoing loyalty and passion for the Volkswagen brand."

VW's U.S. dealers have been barred from selling new diesel vehicles for nearly a year.

The agreement in principle must still be approved by the court. Under the settlement, Volkswagen agreed to repurchase unfixable, used diesel vehicles on dealers' lots under the identical terms such cars must be repurchased from consumers and independent dealers, said Steve W. Berman, a Seattle lawyer representing dealers at the hearing.

The deal would help "heal the wounds between Volkswagen and the dealers," who "like consumers, have been financially hurt here," he said. "They have cars on their lots they can't sell, their franchise value has gone down and they've invested millions in these Volkswagen franchises."

VW had previously agreed to buy back 475,0000 vehicles equipped with 2.0 liter engines.

Judge Charles Breyer of the U.S. District Court, Northern District of California ordered Volkswagen and federal regulators to start settlement talks to resolve the fate of 85,000 3.0 liter diesel vehicles that could include a buy-back offer for those Porsche, Audi and Volkswagen vehicles.

Buying the expensive larger cars and SUVs sold since 2009 could cost VW billions of dollars.

Breyer set a Nov. 3 hearing for an update on the status of the talks and emphasized the urgency of resolving the issue. He said he wanted to ensure "a strong sense of reality" in finding a solution.

VW must submit by late October its specific plans to fix the 3.0 liter vehicles, which it said include a mix of software upgrades and emissions equipment modifications.

Not all details of how the settlement fund will be divided among the dealers have been resolved. VW and the dealers told Breyer they plan to file details of the agreement by the end of September.

The German automaker has been taking a number of steps to resolve outstanding issues related to the emissions scandal.

VW has admitted it installed improper software that deactivated pollution controls on more than 11 million diesel vehicles sold worldwide. In June, it agreed to pay up to $15.3 billion to buy back up to 475,000 vehicles and address claims by federal regulators and 44 U.S. states.

The U.S. Justice Department and Environmental Protection Agency have not yet reached a deal with Volkswagen on fines as part of a separate settlement that could lead to an outside monitor overseeing VW's compliance with U.S. laws.

(Reporting by David Shepardson; Editing by Dan Grebler and Meredith Mazzilli)