U.S. District Judge Rosemary Collyer, based in Washington, ruled that the administration cannot spend billions of dollars in federal funds to provide subsidies under the law known as Obamacare to private insurers without the approval of Congress.
At issue in the case, brought by the Republican-led House of Representatives, are reimbursements to insurance companies to compensate them for reductions that the law requires them to make to customers' out-of-pocket medical payments.
The ruling will not have an immediate effect on the law because the judge put the decision on hold pending an expected appeal by the administration. But it adds to uncertainty over the future of Obama's signature domestic policy achievement ahead of the Nov. 8 presidential and congressional elections, including whether enough health insurers will continue to participate in the program.
Insurers have sustained losses from their Obamacare business, saying they have not attracted enough healthy customers to offset the costs of sicker members. Two of the largest players, UnitedHealth Group and Humana Inc, had already said they would not offer plans in many markets next year.
"If you're going to lose more money, why participate?" asked Steve Halper, an analyst with FBR Capital Markets.
Shares in hospital operators such as Community Health Systems Inc fell sharply, while insurer stocks including Aetna Inc, which plans to remain in at least 15 Obamacare markets next year, also declined.
In court papers, the administration had warned that a court victory for the House Republicans would lead to a spike in insurance premiums for Americans and force the government to pay more in tax credits to insurance policy-holders.
As part of an appeal, the administration is likely to press its argument that the House lacks legal standing to sue.
"This suit represents the first time in our nation's history that Congress has been permitted to sue the executive branch over a disagreement about how to interpret a statute," White House spokesman Josh Earnest told reporters.
"It's unfortunate that Republicans have resorted to a taxpayer-funded lawsuit to re-fight a political fight that they keep losing," Earnest added. "They've been losing this fight for six years, and they'll lose it again."
Conservatives have mounted a series of legal challenges to the Affordable Care Act since it was passed by Congress in 2010 over unified Republican opposition. Collyer was appointed to the bench by Republican former President George W. Bush.
The law has helped bring insurance coverage to millions of Americans who previously had none, subsidizing the cost of insurance through tax credits. In addition, the federal government helped defray consumers' out-of-pocket costs.
The House Republicans argued that the administration's action violated the U.S. Constitution because it is the legislative branch, not the executive branch, that authorizes government spending.
"BIG win for the Constitution," House Speaker Paul Ryan wrote on Twitter.
Jonathan Turley, the lawyer who spearheaded the lawsuit, in a blog post called the ruling "a resounding victory not just for Congress but for our constitutional system as a whole."
The appeals court in Washington may be more receptive to the administration's arguments, in part because seven of its 11 active judges are Democratic-appointees, including four picked by Obama.
The case focuses on a cost-sharing provision of Obamacare that requires insurers to reduce deductibles and co-pays. Insurers are supposed to be reimbursed for these costs by the federal government. Cost-sharing is determined by the income of the policyholder and is a mechanism for reducing healthcare costs for lower-income households.
The Obama administration has interpreted the provision as a type of federal spending that does not need to be explicitly authorized by Congress. The House Republicans who filed the challenge disagreed.
Collyer ruled that the cost-sharing provisions cannot be funded through the same permanent appropriation that covers tax credits made available under the law.
The judge rejected the administration's contention that the appropriation should be viewed as permanent because the alternative interpretation would lead to "absurd economic, fiscal and healthcare policy results."
The U.S. Supreme Court in June 2015, in a ruling authored by Bush-appointed Chief Justice John Roberts, rejected a conservative challenge that could have gutted Obamacare, upholding nationwide tax subsidies crucial to the law. Roberts also wrote a major 2012 ruling preserving Obamacare.