The worries that hung ominously over the U.S. economy early this year appear to have lifted. And that sunnier picture has helped bolster confidence in the stock market — driving the benchmark S&P 500 index to another record high Friday.

The latest dose of encouragement came in a report Friday that the U.S. economy grew much faster than expected in the January-March quarter, suggesting that the nearly decade-long expansion still has a ways to go.

Other recent signs have fed a growing view among many analysts that the economy faces little risk of slipping into a recession anytime soon as some had feared when the year began. Retail sales jumped in March. And with hiring solid and wages rising at a decent pace, consumer spending will likely strengthen in the coming months.

In Friday’s report, the government said the economy grew at a 3.2% annual rate in the first quarter. That’s much better than the 1% or below rate that was forecast in the early weeks of 2019.

Though the economy is widely expected to slow in the current quarter to a roughly 2% rate or less, such a pace would still produce annual growth for the first half of the year of roughly 2.5%. That would be a solid gain. And it would be in line with the modest but steady growth that has prevailed for most of the expansion.

It’s also a far brighter scenario than the one envisioned late last year and early this year. A 35-day partial shutdown of the government remained in effect through most of January. Global growth was sputtering in the midst of the U.S.-China trade war. Stocks plummeted in December as the Federal Reserve raised short-term interest rates for the eighth time in nine quarters and signaled that further tightening was likely. Mortgage rates rose, discouraging many would-be home buyers.

American households also cut back: Retailers’ sales were weak in January and February, adding to the bleak outlook.

Share prices, though, began to rebound in January, after the Fed signaled that it had put any further rate increases on hold, likely for the rest of the year. That emboldened investors, who have become increasingly confident that the economy will avoid the worst-case scenario of a recession.

After falling nearly 20% at the end of last year, the S&P 500 has now recouped all its losses since late September. Though few Americans have substantial stock holdings, rising share prices can help boost consumer confidence.

Economists cautioned that first quarter growth was driven mostly by several temporary factors that should reverse themselves in coming months. Retailers and other companies, for example, sharply increased the stockpiles of goods in their warehouses and on store shelves. Those additions added nearly 0.7 percentage point to the quarter’s growth figure. And the trade deficit narrowed sharply, adding an additional percentage point.

“We know this is not going to be sustainable,” said Joe Brusuelas, chief economist at RSM, a tax consulting firm.

Businesses won’t likely order as many new goods as they wait for consumer spending to reduce their stockpiles. That will probably restrain growth. And the improvement in the trade deficit last quarter occurred partly because imports fell sharply after many companies ramped up their buying from China last year in advance of potential tariff increases the Trump administration had scheduled for Jan. 1.

The White House ended up delaying those tariffs. As imports return to normal, the trade deficit will likely widen again.

Exports also rose in the January-March period, with China stepping up its purchases of U.S. goods, which some economists attributed to a temporary goodwill gesture by Beijing amid high-stakes trade talks between the two countries. Those negotiations are ongoing.

State and local government spending also rose last quarter, mostly to build more highways, which added 0.4 percentage point to growth and may also prove short-lived.

“Taking out the over-sized boosts from net trade, inventories and highways investment, which will all be reversed in the coming quarters, growth was only around 1%,” said Paul Ashworth, an economist at Capital Economics. “Under those circumstances, we continue to expect that GDP growth will slow this year.”

Larry Kudlow, head of President Donald Trump’s National Economic Council, said the administration is sticking by its estimate that growth will top 3% for all of 2019. He argued that low unemployment and solid wage gains will lift consumer spending, thereby boosting auto and home sales.

“I think the prosperity cycle is intact,” Kudlow told CNBC. “I think the Trump policies are working to rebuild America.”

Whether the stock market can continue to march ahead — without additional evidence of corporate or economic strength — is far from clear.

“It’s important to note investors already knew the U.S. economy was the strongest in the world,” said Alec Young, managing director of global markets research at FTSE Russell.

Companies are in the midst of reporting how much profit they made in the first three months of 2019, and investors aren’t expecting much. Analysts are forecasting the first drop in earnings for S&P 500 companies since the spring 2016.

But many companies have so far reported results that were better than Wall Street expected. That’s crucial because stock prices tend to track profit growth over the long term.

© The Associated Press. All rights reserved.