In addition to the rise in consumer and business spending, increases in exports and government spending also helped. Personal consumption expenditures rose 4 percent while business investment grew 7.3 percent and federal government outlays increased by 3.5 percent.
Exports rose in part as farmers rushed to get soybeans to China ahead of expected retaliatory tariffs to take effect in the coming days. Declines in private inventory investment and residential fixed investment were the main drags, the report said.
The tariffs as well as last year's massive tax cut both were key factors in the growth.
"Bottom line, if it wasn't for a big upside to inflation, GDP would have been much better because of the upside in spending, boost in exports and government spending which offset an unexpected sharp decline in inventories and no change in gross private investment," said Peter Boockvar, chief investment officer at Bleakley Advisory Group.
"We hope capital investment continues to improve in light of the tax incentive to ramp up," he added. "The consumer has tax cuts and higher wages on one side and a low savings rate and a recent credit card binge on the other."
In recent days, White House officials had been indicating the reading will be strong.
President Donald Trump himself tweeted a few days ago that the U.S. has the "best financial numbers on the planet," while National Economic Council Chairman Larry Kudlow predicted on Thursday that Q2 GDP will be "big."
The administration has used a mix of tax cuts, deregulation and spending increases to goose growth. White House budget director Mick Mulvaney told CNBC earlier this week that deregulation likely has had the most impact so far as companies feel more comfortable about committing capital.
The next question will be whether the growth spurt is sustainable. There were several jumps in GDP under former President Barack Obama. That Q3 increase in 2014 was preceded by a 5.1 percent rise in the second quarter. But by the end of 2015, growth had slowed to 0.4 percent. Federal Reserve officials forecast GDP to rise 2.8 percent for all of 2018 but then to tail off to 2.4 percent in 2019 and 2 percent in 2020.
Some economists worried that the jump in consumer spending for the April-to-June period may not be sustainable, adding to skepticism that the gains will continue.
"Personal consumption would need to keep up with this impressive pace to see a solid second half," said Ian Lyngen at BMO Capital Markets.
Economists generally expect the trade war between the U.S. and China to temper further growth. Trump has slapped 25 percent duties on $34 billion worth of Chinese imports and has threatened $200 billion more. The administration also has put tariffs on steel and aluminum.
However, more recently the administration said it has made progress on trade agreements with the European Union.
In a recent forecast, Goldman Sachs said the effects from trade disputes are "typically modest," shaving about 0.2 percent from output.
Get the market reaction here.