Vornado Realty Trust has reached a pact to pay $1.8 billion to buy out Donald J. Trump’s estranged Chinese partners in two prominent office buildings.

The two towers, 1290 Avenue of the Americas here and the Bank of America Center in San Francisco, were sold below market value due to Trump’s continuing litigation against Hong Kong-based investors Vincent Lo and Henry Cheng.

Vornado paid $775 per square foot for its 70 percent stake in 1290, though comparable space is fetching well over $1,000 a foot.

Trump is close to Vornado CEO Steve Roth and President Michael Fascitelli.

“Just two days ago, his enemies were his partners, and now his friends are his partners,” said one source familiar with the deal.

Hudson Waterfront Associates, a partnership in which Lo and Cheng are invested, is embroiled in a legal tussle with Trump over the proceeds from the $1.753 billion sale of a development along Manhattan’s Riverside Drive.

As part of yesterday’s deal, Vornado provided certain indemnifications to Hudson Waterfront related to those lawsuits.

“Steve made a great deal with respect to the purchase price only because of his indemnification. Our lawsuit will be successful,” Trump said.

Independent broker Lawrence Russo represented Vornado while Steve Siegel and David Maurer-Hollaender of CB Richard Ellis worked for Hudson Waterfront.

The office buildings are owned by off-shore entities so their sale will not trigger tax consequences.

Vornado understood the structure and with its real estate investment trust status has the flexibility to eventually work out a business deal with Trump.

“Trump may not want so much tied up in Vornado shares over the long run and they don’t like to own with partners, but he’s much better off in the deals with them than the Chinese,” a source said.