After months of uncertainty, America’s $2.7 trillion health-care industry finally has a few answers.

U.S. stocks took a dive Thursday morning in anticipation of the Supreme Court’s decision on the health-care law, then resurfaced later in the day as the effect of the court’s ruling in favor of the law became more clear.

Both the Dow Jones industrial average and the Standard & Poor’s 500-stock index broke a two-day rally to each fall 0.2 percent, while the Nasdaq composite index dropped nearly 1 percent. All three indicators had fallen almost 2 percent earlier in the day before recovering.

The Dow closed at 12,602.26 while the S&P 500 finished at 1329.04.

The Supreme Court’s long-awaited decision that upheld the Affordable Care Act caused health-insurance stocks to plunge shortly after the news, but they recovered soon after.

Health-insurance companies feared that the individual mandate would get overturned and that people would only buy health insurance when they needed it. That would cause premiums to rise and enrollment to shrink.

Health insurers aren’t necessarily thrilled about the prospect of the law taking effect; it means they essentially have to overhaul a business model they have used for decades.

“The law being completely overturned would be the best-case scenario for the managed-care industry immediately,” said Jason Gurda, an analyst with Leerink Swann who covers health care. “Whether this is the best case for the industry depends on where they head in the longer-term direction.”

But with 16 million Americans now expected to gain private health insurance coverage by 2019, one analysis from Bloomberg Government finds that insurers can expect a $778 billion increase in revenue over the next decade.

Hospital stocks rose after the Supreme Court’s announcement. For decades, hospitals have covered the cost of providing health care to the uninsured. A federal law requires emergency rooms to provide stabilizing care to anyone whose life or bodily function may be threatened, and hospitals often get stuck with that bill.

The Affordable Care Act will change that by expanding health insurance to about 30 million more Americans and making insurance companies responsible for paying.

Stocks of pharmaceutical companies, which are not significantly affected by the ruling, were unaffected. Only about 4 percent of that industry’s revenue over the next eight years depends on the Affordable Care Act, according to the Bloomberg Government report.

Across the broader stock market, the health-care ruling was an excuse to sell, analysts said.

The second quarter draws to a close this week and a slew of economic data awaits investors. Company earnings reports and the monthly jobs report are some of the releases expected next week, also coinciding with the Fourth of July holiday.

Analysts are expecting companies to be conservative with their earnings outlook during the growing belief that the global economy is stagnating.

There was little optimism ahead of Thursday’s latest euro-zone summit meeting in Brussels. A late announcement by European Council President Herman Van Rompuy said that leaders had agreed to spend $149 billion for “immediate growth measures” in the region.

The Stoxx 50 index of euro-zone companies ended the day down by 0.4 percent and the German DAX fell more than 1 percent.

JPMorgan Chase’s stock dropped following news that its trading losses could be much higher than the previously estimated $2 billion. This follows last week’s downgrade by Moody’s ratings agency of major investment banks, including JP Morgan Chase.

The energy sector surged, particularly Canadian energy stocks, after Petronas bought Progress Energy Resources for $4.65 billion. Progress Energy rose 73 percent.