WASHINGTON — A summer of modest economic growth is helping dispel lingering fears that another recession might be near. Whether the strength can be sustained is less certain.

The economy grew at an annual rate of 2.5 percent in the July-September quarter, the Commerce Department said Thursday. But the growth was fueled by Americans who spent more while earning less and by businesses that invested in machines and computers, not workers.

The expansion, the best quarterly growth in a year, came as a relief after anemic growth in the first half of 2011, weeks of wild stock market shifts and the weakest consumer confidence since the height of the Great Recession.

The economy would have to grow at nearly double the third-quarter pace to make a dent in the unemployment rate, which has stayed near 9 percent since the recession officially ended more than two years ago.

For now, the report on U.S. gross domestic product, or GDP, sketched a more optimistic picture for an economy that only two months ago seemed at risk of another recession. And it came on the same day that European leaders announced a deal in which banks would take 50 percent losses on Greek debt and raise new capital to protect against defaults on sovereign debt.

Stocks surged Thursday on news of the European deal and maintained their gains after the report on U.S. growth was released. The Dow Jones rose 340 points to close at 12,209. The Dow hadn’t closed above 12,000 since Aug. 1. The Standard & Poor’s 500 index is close to having its best month since 1974.

If higher stock prices lead consumers to feel more confident about their wealth, they may spend more.

That could help sustain economic growth.

The GDP report measures the country’s total output of goods and services. It covers everything from bicycles to battleships, as well as services such as haircuts and doctor’s visits.

Some economists doubt the economy can maintain its modest third-quarter pace. U.S. lawmakers are debating deep cuts in federal spending next year that would drag on growth. And state and local governments have been slashing budgets for more than a year.

President Obama’s $447 billion jobs plan was blocked by Republicans, meaning that a Social Security tax cut that put an extra $1,000 to $2,000 this year in most American’s pockets could expire in January.

So could extended unemployment benefits. They have been a key source of income for many people out of work for more than six months. Nor is the economy likely to get a lift from the depressed housing market.

Other economists are a bit more optimistic. The breakthrough in Europe could help, as long as a final deal is implemented. At a minimum, that would remove what many economists had considered a major threat to the U.S. economy.

But what would help most is if businesses hired workers.

“The expansion is broad-based and sustainable,” said Joel Naroff of Naroff Economic Advisors. “If we can only get some better job gains, confidence will begin to return and we can accelerate the recovery.”