WASHINGTON (Reuters) - The number of Americans collecting long-term unemployment aid fell to the lowest in three months in mid-July, according to government data that implied a slowing pace of layoffs as the economy stabilizes.

The U.S. Labor Department said that while initial claims for state unemployment insurance benefits rose by 25,000 to a seasonally adjusted 584,000 last week, the number of people still on benefit rolls after collecting an initial week of aid fell by 54,000 to 6.20 million in the week to July 18, the lowest since early April.

In addition, the four-week moving average for new claims, considered to be a better gauge of underlying trends, fell by 8,250 to 559,000, the lowest since late January.

The weekly moving average has declined for five straight weeks. New applications for unemployment benefits have in recent weeks been distorted by automobile plant closures for retooling which normally happens in July.

Further, automobile plant closures related to General Motors and Chrysler bankruptcies have also caused volatility, making it difficult to gauge labor market trends.

Analysts said the general trend, however, was still toward a slowdown in the rate of layoffs, as illustrated by a consistent decline in the four-week moving average for new claims. This measure irons out weekly volatility.

“It is becoming increasingly evident that the underlying pace of layoffs is slowing,” said Stephen Stanley, an economist at RBS Securities in Greenwich, Connecticut. “The reality, outside of the auto sector at least, is that layoffs have probably been moderating steadily for several months.”

The weekly jobs data, together with a string of stronger-than-expected quarterly corporate profits, sparked a further rally in U.S. stocks on Thursday. The benchmark Standard & Poor's 500 stock index .SPX briefly rose to its highest intraday level in almost nine months and came within striking distance of the key 1,000 level.

Recent data, including home sales and prices, have added to growing optimism that the recession is ending but high unemployment still weighs on consumer sentiment, which could result in the anticipated economic recovery being feeble.

But President Barack Obama sounded a word of caution, telling reporters that second quarter gross domestic product (GDP) data due on Friday would show the economy contracted and job losses were still a “huge” problem.

A Reuters survey forecast GDP fell at a 1.5 percent annual rate in the second quarter after dropping 5.5 in the January-March period. Analysts reckon the economy will start growing in the third quarter, partly lifted by the government’s $787 billion stimulus package.

Initial jobless claims are being monitored for signs of stability in the labor market and the number of laid off workers on jobless rolls fell for a third straight week.

The insured unemployment rate, which measures the percentage of the insured labor force who are jobless, was unchanged at 4.7 percent in the week ended July 18, remaining at that level for a third consecutive week.

Analysts said the sustained decline in continuing claims raised the chances of a less steep decline in July nonfarm payrolls data, due to be released next week.

“More to my liking is that continued claims are falling. There is the possibility that July’s payroll number could be better but that number could be suspect because of auto and seasonal adjustments in July,” said Lee Olver, a fixed income strategist at SMH Capital in Houston, Texas.

A Reuters survey forecast U.S. nonfarm payrolls would be down 340,000 in July after shrinking 467,000 in June. The unemployment rate is forecast to rise to 9.7 percent from 9.5.