The American economy recovered from a plodding start in the first three months of 2017, when sharp cuts in consumer spending limited G.D.P. growth to 1.2 percent on an annualized basis. It sprang back over the next six months, with the rate reaching 3.1 percent in the second quarter and 3.2 percent in the third.

In the fourth quarter, holiday shoppers were enthusiastic, and spending on business and residential housing was up. A persistent appetite for foreign goods continued to widen the trade deficit — it reached nearly $72 billion for goods alone in December — and dragged down gains. But inventory declines that detracted from G.D.P. last quarter should rebound over the next as businesses refill empty shelves.

The American economy’s performance has also been buoyed by simultaneous growth in nations around the world, which has fueled trade and enabled foreign consumers to buy more American-made products.

For several years after the recession, the United States’ steady if unremarkable growth was a bright spot compared with struggling economies abroad. Under President Barack Obama, who took office when the economy was floundering, yearly growth averaged 2.1 percent during the recovery. After a high of 2.9 percent in 2015, it dropped to 1.5 percent in 2016.

But in 2017, more than eight years into the nation’s recovery, the expansion spread to at least 120 countries, according to a report released this week by the International Monetary Fund. In several, growth rates outpaced that of the United States. Among large economies in the Group of 7, the United States ranked fifth, according to a report from the World Economic Forum. On a list of 29 advanced economies, it ranked 10th, though it sank close to the bottom in terms of equitably sharing the gains.

Exhilarating stock market gains have also been a worldwide phenomenon. Lawrence H. Summers, the Harvard economist and former Treasury secretary, pointed out that the major stock indexes in Japan, Hong Kong, Germany and South Korea registered gains comparable to the Standard & Poor’s 500-stock index, if not better.

“The U.S. performance doesn’t stand out relative to the rest of the world,” he said.

The I.M.F. warned against assuming that the current economic cycle would go on indefinitely, however, particularly given the towering debt of the United States and other countries. By borrowing so much, the government can crowd out other investors and drive up interest rates. At the same time, giant deficits crank up pressure to cut government spending on health care and housing, policing and schools. With less money to go around, spending dries up and consumer demand — the economy’s primary engine — slows.