The economy grew at its fastest pace in more than six years in the fourth quarter, surprising economists, as businesses curbed their aggressive cut in stocks and stepped up spending.

The robust growth pointed to a sustainable recovery in a crucial period before government stimulus plans run out and was good news for an administration amid political difficulties.

Gross domestic product expanded at a 5.7 percent annual rate, the Commerce Department said on Friday in its first estimate for the quarter. It was a strong end to a year in which the economy shrank by 2.4 percent -- the worst performance since 1946.

While much of the growth resulted from companies' drawing down inventories more slowly than they did earlier in the year rather than from a surge in domestic demand, economists said it was still a positive report.

The data shows that the necessary transition from government stimulus to private sector spending is under way, which is essential to sustain the economic expansion, said Stuart Hoffman, chief economist at PNC Financial Services Group in Pittsburgh.

U.S. stocks initially rallied on the eye-catching growth number but ended down on worries about credit troubles in Europe. Stock market losses fed investors' preference for safe-haven U.S. government bonds, while the U.S. dollar rallied against major currencies.

Getting the economy on a sustainable growth track remains one of the key challenges facing President Barack Obama, who on Wednesday outlined measures to create jobs and nurture the recovery.

The government will release its closely watched employment report for January next Friday. A Reuters survey forecast payrolls grew by 5,000 jobs after an 85,000 drop in December.

The economic picture was further brightened by a jump in Midwest business activity in January to its highest level in four years, while consumer confidence hit a two-year high.

Economists said they expected the lift from inventories to fade over time, with economic growth moderating in the second half of the year.

The economy's engine is running, but to some degree we're still in a ditch spinning our wheels. With fiscal and monetary fuel running out, we need job growth to get us firmly on the road to recovery, said Bill Cheney, chief economist at John Hancock Financial in Boston.

INVENTORIES BOOST GROWTH

The slowing rate of inventory reduction in the fourth compared to the third quarter lifted GDP by nearly 3.4 percentage points, the biggest contribution inventories have made to GDP growth since the fourth quarter of 1987.

When businesses sell off inventories, there is less of a need to step up production and it weighs on GDP. With the liquidation rate slowing, GDP was boosted.

But even with inventories stripped out, the economy expanded at an annual rate of 2.2 percent, accelerating from the 1.5 percent increase in the third quarter. That reflected relatively strong performance from other segments of the economy, particularly business investment.

Still, this measure of final demand is meager compared with most normal recoveries, implying the Federal Reserve can bide its time before raising interest rates.

Consumer spending increased at a 2 percent annual rate, contributing 1.44 percentage points to GDP. In the third quarter, consumer spending had risen at a 2.8 percent pace, supported by the government's cash for clunkers program.

Business investment grew at 2.9 percent rate, the first increase since the second quarter of 2008, as the drag from the troubled commercial real estate was offset by robust spending on equipment and software.

The solid increase in investment in equipment and software, if confirmed, might indicate that a more solid recovery is under way, said Harm Bandholz, an economist at UniCredit Research in New York. Some economists said it suggested a budding confidence that could lead to hiring.

Third-quarter growth was put at 2.2 percent after an earlier estimate of 3.5 percent.

The growth of spending on new home construction braked sharply in the fourth quarter to an annual rate of 5.7 percent from an 18.9 percent pace in the third quarter.

Home building has received a lift from a popular tax credit for first-time buyers, but recent data have hinted at some weakness. Export growth outpaced imports, narrowing the U.S. trade gap and adding half a percentage point to GDP growth in the last quarter.

For graphic on GDP, see: http://link.reuters.com/suk66h

For graphic on GDP and inventories see http://link.reuters.com/pem66h

(Additional reporting by Lisa Lambert; Editing by Kenneth Barry)