NEW YORK (Reuters) - U.S. stocks showed signs of stabilizing on Thursday, but gains were kept in check by conflicting comments on trade talks from President Donald Trump and Beijing that reinforced concerns about a potentially lengthy battle harming global growth.

Trump said talks with China were going well but those comments were countered by a senior Chinese diplomat who said provoking trade disputes is “naked economic terrorism.”

The lack of clarity around the trade battle has rattled investors of late, after the S&P 500 had risen more than 17% through the first four months of the year on optimism a trade deal between the two countries could be reached.

That optimism has faded, however, as the escalating dispute between the two countries has weighed heavily on Wall Street in May, with each of the three main indexes declining at least 5% for the month. Thursday’s gains marked the first advance for major U.S. indexes this week.

“After multiple days of down, down, down the market usually takes a collective breath for some stability and a re-evaluation of risk,” said Ben Phillips, chief investment officer at Eventshares in Newport Beach, California.

“The market is coming to the realization that we are not getting really clean or clear information and it is going to be a lot of noise and just prepare for that.”

A government report on Thursday showed U.S. inflation was much weaker than initially thought in the first quarter on a sharp slowdown in domestic demand, while growth was also slightly lower than estimated in April.

The Dow Jones Industrial Average rose 43.47 points, or 0.17%, to 25,169.88, the S&P 500 gained 5.85 points, or 0.21%, to 2,788.87 and the Nasdaq Composite added 20.41 points, or 0.27%, to 7,567.72.

Trade jitters helped sustain demand for safe haven debt, as U.S. Treasury yields held near 20-month lows. The yield curve between three-month bills and 10-year notes remained inverted, the inversion the widest in nearly 12 years.

That, in turn, weighed on interest-rate sensitive bank stocks, which dropped 1.2% and were on track for a third straight day of declines, while the broader financial sector declined 0.5%.

The energy sector fell 1.2%, as oil prices settled down nearly 4% in part due to a smaller-than-expected decline in U.S. crude inventories. The sector has fallen more than 10% this month.

Among stocks, Dollar General Corp jumped 7.2% after the discount retailer’s same-store sales and profit topped expectations.

PVH Corp plunged 14.9% as the worst performer on the S&P 500, after the Calvin Klein owner cut its annual profit forecast as it grapples with tariffs and slowing retail growth.

Declining issues outnumbered advancing ones on the NYSE by a 1.11-to-1 ratio; on the Nasdaq, a 1.38-to-1 ratio favored decliners.

The S&P 500 had one new 52-week high and 25 new lows; the Nasdaq Composite 25 new highs and 119 new lows.

About 6.25 billion shares changed hands in U.S. exchanges, compared with the 6.99 billion daily average over the last 20 sessions.