TRENTON — New Jersey legislators and Gov. Chris Christie struck a budget deal on Monday night that reopened state beaches and parks for the Fourth of July holiday, ending a standoff over Mr. Christie’s demand that the governor’s office be given more control over the state’s largest health insurer.

Mr. Christie appeared to have backed off on a demand that had brought the budget process to a halt: that the state’s largest health insurer, Horizon Blue Cross Blue Shield, turn over $300 million from its reserves to fund opioid addiction therapy, an issue Mr. Christie has made the focus of his last months in office.

During a news conference late Monday night in Trenton, Mr. Christie acknowledged that he would have preferred that the money go to the drug treatment programs.

“I gave in on one point, yeah,” he said. “That’s the nature of compromise.”

The stalemate reverberated far beyond New Jersey after photos were published showing Mr. Christie relaxing on a state beach that had been closed by the impasse, infuriating many people whose own beach plans had been upended and unleashing a torrent of derision on social media.