The numbers: The bustling U.S. economy was even stronger in the spring than initially reported thanks to higher government spending and business investment. And companies cashed in big time.

Gross domestic product expanded at a 4.2% annual pace in the second quarter, up from a preliminary estimate of 4.1%, the government said. GDP is the official measuring stick for the U.S. economy.

Economists polled by MarketWatch had forecast GDP to be left unchanged at 4.1%.

The strong growth, along with the biggest tax cuts in 31 years, helped fill corporate coffers.

Adjusted corporate profits before taxes climb 3.3% in second quarter and they were up a sizzling 7.7% over past year. That’s the biggest 12-month gain in four years.

What happened: Consumer spending will still quite strong in the second quarter, though a bit less so than previously believed. The government said outlays rose 3.8% instead of 4%.

Businesses investment was a touch stronger, contributing to overall growth instead of subtracting from it. Firms spent more on software and equipment.

Yet the value of unsold goods, or inventories, was still a big drag on second-quarter growth. They fell at a revised $27 billion annual rate.

Exports rose at a slightly revised 9.1% annual clip, though the government said imports fell at a 0.4% rate instead of increasingly slightly. The smaller trade deficit added to strong GDP, though it’s unlikely to last.

Government spending, meanwhile, advanced 2.3% instead of 2.1%, largely reflecting higher spending on the military.

The rate of inflation was moved up to a 1.9% annual pace from 1.8%.

Most other figures in the GDP were little changed.

Big picture: The economy hasn’t been this strong since the early 2000s as evidenced by key stock indexes such as the S&P 500 setting new record highs.

The U.S. might top 3% growth in 2018 for the first time since 2005, buoyed by strong hiring, falling unemployment, higher incomes and rising business investment.

Americans increasingly show their optimism in the economy. Consumer confidence rose in August to the highest level in 18 years and reached a peak it’s only matched a few other times in a half century.

Read:Americans haven’t been this confident in the economy since 1990s Internet boom

Don’t expect 4% growth in the third quarter, though. Early signs point to the trade deficit widening and that’s a negative for GDP. Consumer spending rarely rises at such a high rate two quarters in a row.

What’s more, the U.S. has averaged just 2% annual growth during the current nine-year-old expansion. Most economists contend GDP can’t expand much faster than that because of low productivity and a slower increase in the population, the two most critical launching pads for growth.

What they are saying? “The bottom line is that the economy remains on a solid growth path and still appears to have the potential to remain on a positive track for some time to come,” said Jim Baird, chief investment officer at Plante Moran Financial Advisors.

Market reaction: The Dow Jones Industrial Average DJIA, +1.33% the S&P 500 SPX, +1.59% both rose in Wednesday trades. The S&P 500 and Nasdaq COMP, +2.26% both set a fresh record high. The stock market has surged after President Trump announced a pending new free-trade deal with Mexico.

Read:Trump deal with Mexico eases fears of trade wars