Still, recent data does suggest that the pace of growth has picked up this year. Some economists think full-year growth in gross domestic product could hit 3 percent in 2018 for the first time in the nearly decade-long recovery.
“The bottom line is that the economy is doing better,” said Diane Swonk, chief economist for the accounting firm Grant Thornton.
Mr. Trump didn’t wait for the numbers to be released to herald rosy news. At an event in Iowa on Thursday, he said he was expecting very strong result, noting predictions that ran to 5 percent or higher.
“We’ll take anything with a four in front,” he said.
Friday’s figures were pumped up by a surge in exports. Paradoxically, the export boom was driven in part by mounting trade tensions, which led foreign buyers to stock up on American products before their governments imposed tariffs.
The trend is particularly clear in exports of soybeans, which were up more than 50 percent in May from a year earlier. Those buyers presumably didn’t want more soybeans than usual — they just wanted them sooner. Exports will almost certainly slump in the third and fourth quarters, and will turn into a drag on overall G.D.P. growth.
“We’re getting explosive growth in the second quarter because of trade,” said Ellen Zentner, chief United States economist for Morgan Stanley. “You’ve got a big hole on the other side of that.”
A Stimulating Trend
Friday’s strong figures also reflected an increase in government spending tied to the budget deal that Congress passed this year. The effects of the spending deal won’t be quite as short-lived as the trade bump, but they are likewise temporary; economists think the impact on growth will peak late this year.
Government spending isn’t the only policy elevating economic growth. Republican tax cuts are probably also playing a role, although the effects are hard to quantify.
Whether those policies are a good idea is another question. Many economists question the wisdom of passing what amounts to a deficit-funded stimulus package when unemployment is low and the economy is strong. Few outside the White House think a growth rate of 4 percent is sustainable in the long term.
The View From Washington
Even with all the caveats, Friday’s report is good news for Mr. Trump, and for Republican congressional candidates hoping that the strong economy will improve their chances in the midterm elections this fall. The government won’t release its initial estimate of third-quarter G.D.P. until Oct. 26, just over a week before Election Day, and after many voters will have made up their minds.
The new numbers are unlikely to surprise Federal Reserve policymakers, who are expected to leave interest rates unchanged at their meeting next week. The combination of faster growth and rising inflation could make it more likely that the Fed will stick to its policy of gradual rate increases, despite recent hints from Mr. Trump that he would prefer to see rates stay low.