The U.S. economy contracted at slower pace than previously thought in the second quarter as improved consumer and business spending cushioned the impact of a record decline in inventories, according to a government report on Wednesday.

The Commerce Department's final estimate showed gross domestic product fell at a 0.7 percent annual rate instead of the 1.0 percent decline reported last month.

Analysts polled by Reuters had forecast GDP, which measures total goods and services output within U.S. borders, slipping at a 1.2 percent rate in the second quarter after dropping 6.4 percent in the January-March period.

This will probably mark the last quarter of decline in output for the U.S. economy, which slipped into recession in December 2007. The economy is believed to have rebounded in the July-September quarter.

With the second-quarter contraction, the country's real GDP has shrunk for four straight quarters for the first time since government records started in 1947.

The shallow decline in activity in the second quarter reflected more moderate drops in consumer spending and business investment than previously thought, the report showed.

Consumer spending, which normally accounts for over two-thirds of U.S. economic activity, fell at a 0.9 percent rate in the second quarter -- smaller than the previously estimated 1.0 percent decline. Spending rose at a 0.6 percent rate in the previous quarter.

Business investment fell at a 9.6 percent rate in the second quarter instead of 10.9 percent, reflecting slightly better demand for software than previously thought. It tumbled 39.2 percent in the first quarter.

Weak domestic demand meant businesses continued to reduce their stock of unsold goods. Business inventories plunged by a record $160.2 billion in the second quarter rather than the $159.2 billion drop estimated by the government last month. Stockpiles of unsold goods fell by $113.9 billion in the first quarter.

The drop in inventories subtracted 1.42 percentage points from second-quarter GDP, the department said. Excluding inventories, GDP rose 0.7 percent in the second quarter compared to a 4.1 percent decline in the first quarter.

The department said corporate profits after taxes rose 0.9 percent, much lower than the 2.9 percent it estimated last month. It compared to analysts' forecasts for 3.0 percent growth.

After tax corporate profits increased 1.3 percent in the first quarter.

Investment in nonresidential structures fell at a 17.3 percent rate compared to a 43.6 percent drop in the January-March quarter. Residential investment, at the heart of the worst U.S. recession in seven decades, dropped at a 23.3 percent rate in the second quarter. It fell 38.2 percent in the first quarter.

There was encouraging news on the trade front. Exports fell at a smaller 4.1 percent rate instead of the 5 percent drop reported last month, the department said. Exports plunged 29.9 percent in the first quarter.

There were positive contributions from the federal, state and local government during the second quarter.

(Reporting by Lucia Mutikani; Editing by Andrea Ricci)