US economic growth rose in the third quarter to reach an annualized rate of 2%, higher than expected and fueled by rising consumer confidence, the fledgling recovery in the housing market and an increase in government spending.

The latest figures from the commerce department are the last before November's election and come as US economic recovery – or the lack of it – has dominated the 2012 election cycle.

The third-quarter GDP figures contain good and bad news for Barack Obama as he fights to defend his economic record against challenger Mitt Romney.

In a blog post Alan Krueger, chairman of Obama's Council of Economic Advisers, wrote: "While we have more work to do, together with other economic indicators, this report provides further evidence that the economy is moving in the right direction."

Romney called the rise "discouraging". "Slow economic growth means slow job growth and declining take-home pay. This is what four years of president Obama's policies have produced. Americans are ready for change — for growth, for jobs, for higher take-home pay," he said in a statement.

The rise was higher than the 1.8% economists surveyed by Dow Jones Newswires had expected. The economy has now grown for 13 consecutive quarters. But at 2% growth remains extremely weak and the latest report contained worrying signs that business is cutting back, fearing a worsening of economic conditions.

Consumer spending accounted for most of the rise in GDP. Personal consumption expenditures rose 2% in the quarter, up from 1.5% in the previous quarter. Purchases of long-lasting goods soared 8.5%. The news came as the Thomson Reuters/University of Michigan consumer confidence index rose to its highest level since September 2007.

But while consumers are spending again, business confidence seems to be weakening. Non-residential fixed investment, which includes business spending on structures and equipment, fell 1.3% during the third quarter, compared with a 3.6% gain in the prior period. The pullback suggests businesses are reigning in spending ahead of the election and the uncertainty over the so-called "fiscal cliff" – the expiration of Bush-era tax cuts and imposition of massive spending cuts scheduled for the end of the year unless political compromise is found.

Paul Dales, a senior US economist at Capital Economics, said it was clear that the fiscal cliff was proving a drag on business investment. Capital Economics calculates that Europe's economic woes have knocked another 0.5% off US GDP.

"Things aren't too bad in the US. Growth remains weak but it is still growth," he said.

But he said there were worrying signs ahead, and that consumers could become less confident if the fiscal cliff debate is not addressed soon.

"Personally I don't think we will go off the fiscal cliff, but I also imagine a deal will not be done until the last minute, which could prove very worrying to consumers," Dales said.

The GDP figures come a week before next Friday's nonfarm payroll jobs number – the last before polling day. The nonfarm payroll figures have become a monthly flashpoint in the election. Last month, jobs growth rose 114,000, higher than expected, the figures remain weak but the move was enough to send the unemployment rate down to a three-and-a-half-year low of 7.8%.