The economy stumbled badly in the first half of 2011 and came dangerously close to contracting in the January-March period, raising the risk of a recession if a stand-off over the nation's debt does not end quickly.

The Commerce Department data on Friday also showed the current lull in the economy began earlier than had been thought, with the growth losing steam late last year.

That raised questions on the long held view by both Federal Reserve officials and independent economists that the slowdown in growth this year was mostly due to transitory factors.

The economy essentially came to a grinding halt in the first half of this year, said Ryan Sweet, a senior economist at Moody's Analytics in West Chester Pennsylvania. We did get side-swiped by some temporary factors which are fading, but it raises some concerns about the sustainability the recovery.

The economy grew at a 1.3 percent annual pace in the second quarter after expanding just 0.4 percent in the first three months of the year. First-quarter growth was revised from the previously reported 1.9 percent increase.

While the recovery stepped-up in the second quarter, economists had expected a stronger 1.9 percent reading.

Fourth-quarter growth was revised to a 2.3 percent rate from 3.1 percent.

There is also heightened uncertainty over the outlook because of the impasse in talks to raise the nation's $14.3 trillion borrowing limit and avoid a damaging government debt default, although the budget cuts a deal may impose could also weigh on growth.

The Treasury has said it will run out of borrowing authority on Tuesday and the government could quickly run out of enough cash to pay all its bills.

This should wake up those in Washington who still have their thinking caps on, said Joel Naroff of Naroff Economic Advisors in Holland, Pennsylvania. There is no margin for error and a default that lasted any length of time could push us back into recession.

U.S. stocks fell on the data, while prices for government debt rose. The dollar fell against a basket of currencies.

FUNDAMENTAL SLOWDOWN?

Economists had expected the economy would show signs of perking up by now with Japan supply constraints easing and gasoline prices off their high, but data has disappointed.

This and the sharp downward revisions to the prior quarters suggest a more troubling and fundamental slowdown might be underway. The slow down could pose a dilemma for the Fed.

This raises difficult issues for policymakers. The Fed has indicated it feels its hands are tied by high inflation. Yet the U.S. economy is clearly not yet launched into a self-sustaining recovery dynamic, said Julia Coronado, chief North America economist at BNP Paribas in New York.

The March earthquake in Japan severely disrupted U.S. auto production. The resulting shortage of motor vehicles weighed on retail sales as consumers were unable to find the models they wanted. That combined with high gasoline costs to curb spending.

Consumer spending, which accounts for about 70 percent of U.S. economic activity, decelerated sharply to a 0.1 percent rate -- the weakest since the recession ended two years ago.

And the outlook for consumer spending is not encouraging. The Thomson Reuters/University of Michigan's index of consumer sentiment fell to 63.7 in July from 71.5 in June, a separate report showed.

SUPPLY DISRUPTIONS WEIGH

Motor vehicle production subtracted 0.12 percentage point from gross domestic product growth in the second quarter, after adding 1.08 percentage points to first-quarter GDP growth.

The composition of growth in the April-June quarter was weak and could prompt economists to dial down their expectations for a solid rebound in the third quarter.

A smaller trade deficit, as imports slowed, was one of the main contributors to the rise in second-quarter growth, with businesses spending and inventory investment also adding to output.

Government spending declined again as state and local authorities continued to pare their budgets, even though defense expenditures rebounded at 7.3 percent rate after contracting at a 12.6 percent rate in the first three months of the year.

Home building rose at a 3.8 percent pace, while investment in nonresidential structures increased at an 8.1 percent rate.

The easing of the auto parts disruptions and a drop in gasoline prices could be a tail wind to third-quarter growth, but economists are concerned that data for June has been weak.

The report showed a moderation in inflation, with the overall consumer prices rising at a 3.1 percent rate after rising 3.9 percent in the first quarter. But excluding food and energy, prices increased 2.1 percent, the fastest since the fourth quarter of 2009 and above the Federal Reserve's preferred 2.0 percent level.

Data released along with the latest GDP figures on Friday also showed the 2007-2009 recession was much more severe than prior measures had found.

(Editing by Neil Stempleman)