U.S. stocks traded mildly higher Thursday, as gains in the healthcare sector offset global concerns about the stalled negotiations between Greece and its European creditors, with the expiration of the country’s bailout program less than a week away. Thursday’s gains were driven by the healthcare sector, after the U.S. Supreme Court ruled federal subsidies under the Affordable Care Act are legal.

In afternoon trading, the Dow Jones Industrial Average (INDEXDJX:.DJI) added 7 points, or 0.04 percent, to 17,973.07. The Standard & Poor’s 500 index (INDEXNASDAQ:.IXIC) ticked up 1.82 points, or 0.09 percent, to 2,110.23. The Nasdaq composite (INDEXSP:.INX) rose 4.69 points, or 0.08 percent, to 5,126.05.

The S&P 500 healthcare sector added 0.5 percent, driven by a rally in hospital stocks. The ruling helps the healthcare sector because it removes another uncertainty over whether the Supreme Court would rule against those state exchanges or the subsidies to exchanges, says Tim Dreiling, senior portfolio manager at U.S. Bank's Private Client Reserve. 

"The big question was how would companies pay for it if the ruling fell apart," Dreiling said. "The decision helped move healthcare stocks up because now we have a clear future going forward." 

Tenet Healthcare Corp. (NYSE:THC) rallied 14 percent following the Supreme Court decision, while HCA Holdings Inc. (NYSE:HCA) and Universal Health Services Inc. (NYSE:UHS) gained 9 percent and 8 percent, respectively.

Dow component UnitedHealth Group Inc. (NYSE:UNH) led the blue-chip index higher Thursday, up 3 percent, while construction and mining equipment company Caterpillar Inc. (NYSE:CAT) was the biggest laggard, down more than 1 percent.

Greece failed to reach a deal with its international creditors Thursday, reviving concerns that a "Grexit” could ensue in which Athens would default and leave the eurozone. The country must repay 1.6 billion euros ($1.8 billion) to the International Monetary Fund on June 30.

However, officials are scheduled to meet again on Saturday for a last-ditch effort to save Greece from defaulting on its debt next Tuesday. 

"The door is still open for the Greek side to come with new proposals or accept what is on the table," Eurogroup Chairman Jeroen Dijsselbloem told reporters in Brussels Thursday ahead of a European Union summit next door, Reuters reported

U.S. consumer spending, which accounts for more than two-thirds of economic activity, rose to its highest in nearly six years last month. Consumer spending rose 0.9 percent in May from a revised 0.1 percent rise in April, the Commerce Department said Thursday.

This was the biggest increase in consumer spending since the "Cash for Clunkers" auto sales surge in August 2009. The rise signals consumers are finally ramping up their purchases and spending some of their boosted savings due to lower gasoline prices, as the savings rate fell to 5.1 percent in May from 5.4 percent.

“This report should remove some of the worry surrounding the consumers’ willingness to spend that came with April’s disappointing report,” Gregory Daco, head of U.S. macroeconomics at Oxford Economics, said in a research note Thursday.

The spending numbers for May confirm that the economy is bouncing back after a soft first quarter. “It appears that households are also getting more comfortable spending some of the money that they have saved because of lower gasoline prices,” Gus Faucher, senior economist at PNC Financial Services Group,” said in a note.

Separately, the number of Americans filing new claims for unemployment benefits rose last week as initial claims increased by 3,000 to a seasonally adjusted 271,000 for the week ending June 20, the U.S. Labor Department said Thursday.

However, the number was still below expectations, as economists had forecast jobless claims would rise by 5,000 to 272,000 last week, according to analysts polled by Thomson Reuters.