UBS cashed out of 299 Park Ave. on Thursday, selling its 49.5 percent stake to real estate investment firm Rockpoint Group, The Post has learned.

Rockpoint paid $150 million cash for the stake and assumed part of a $325 million mortgage.

The deal, which provides a much-needed boost to the real-estate sales market, valued the 1.04 million-square-foot building at just over $600 million, or $625 per square foot.

UBS, which houses its investment banking, global asset management and wealth management divisions at 299 Park, said the deal wouldn’t affect its lease for about two-thirds of the building. The lease runs through 2018.

The marketing, through Darcy Stacom and Bill Shanahan at CB Richard Ellis, slogged through the latter half of last year as potential buyers dropped away and UBS stuck to its pricing.

The nation’s ongoing financing issues hampered a speedy conclusion, as did a right of first refusal by Fisher Bros., the operating partner that eventually brought Rockpoint to the table.

“UBS was able to monetize its investment, Fisher likes the partner and Rockpoint gets a good asset and return,” said one source familiar with the deal.

Rockpoint’s return will be over 6 percent and there is a growing war chest for capital improvements after UBS exits, sources said.

“This is a signal the market is continuing to strengthen and — dare I say it? – recover,” said Woody Heller of Studley, who was not involved in the deal. “To see Rockpoint come forward into the transaction is an affirmation that there is investor confidence in a new pricing paradigm.”

In contrast, the multi-property HSBC headquarters at 492 Fifth Ave. near Bryant Park, was sold for $380 a foot. The entire space will be leased back to HSBC for one year, then the company will occupy about two-thirds of it for nine more years.