The United States economy rebounded strongly in the second quarter of the year, shaking off the negative effects of an unusually harsh winter and stirring hopes that it might finally be establishing a solid enough footing to put the lingering effects of the recession squarely in the past.

The Commerce Department, in its initial estimate for April, May and June, reported on Wednesday that the economy grew at a seasonally adjusted annual rate of 4 percent, surpassing expectations.

During the first quarter, output shrank at a rate of 2.1 percent, less than had been reported. The department had earlier said that first-quarter output fell 2.9 percent.

Some experts, citing a range of indicators including an improving job market, were encouraged by the signs of healthy business investment and consumer spending, but others cautioned that the economy had yet to break out of an underlying pattern of steady but relatively sluggish growth that has plagued the nation since the Great Recession officially ended in mid-2009.