The U.S. trade deficit widened less than expected in April as the lowest petroleum bill in nearly 2-1/2 years tempered the rise in imports, while exports hit a four-month high.

The Commerce Department said on Tuesday the trade gap increased 8.5% to $40.3 billion. March's shortfall on the trade balance was revised to $37.1 billion from the previously reported $38.8 billion.

Economists polled by Reuters had expected the trade deficit to rise to $41.0 billion in April. 

When adjusted for inflation, the trade gap increased to $47.6 billion from $44.6 billion in March. 

The widening in the so-called real trade deficit could prompt economists to lower their already low estimates for second-quarter gross domestic product.

The economy has hit a speed bump, with higher taxes and government spending cuts crimping consumer spending and weighing on manufacturing activity. Growth estimates for this quarter currently range between a 1.2% and 2% annual pace.

The economy grew at a 2.4% rate in the first three months of the year, with trade subtracting a fifth of a percentage point from output.

The three-month moving average of the trade deficit, which irons out month-to-to month volatility, slipped to $40.42 billion in the three months to April from $41.22 billion in the prior period.

Annual revisions showed the trade deficit in 2012 was smaller than previously reported, with exports revised higher. 

In April, imports of goods and services increased 2.4% to $227.7 billion. The rebound in imports was mitigated by the lowest value of petroleum imports since November 2010. 

Exports of goods and services increased 1.2% to $187.4 billion, the second highest on record. 

Strong export growth helped to lift the economy out of the 2007-09 recession, but momentum has waned in recent months against the backdrop of slowing global demand, especially in China and recession-hit Europe.

The impact from U.S. dollar strength earlier in the year is also taking steam out of export growth. 

U.S. exports to the 27-nation European Union fell 7.9% in April. Exports to the EU in the first four months of 2013 were down 7.4% compared to the same period in 2012. 

Exports to the United Kingdom were the lowest since May 2009. Exports to China, which have been growing more slowly than in recent years, declined 4.7% in April.

China has been one of the fastest growing markets for U.S. goods, and exports to that country were up 4.8% for the first four months of 2013.

Imports from China surged 21.2 percent, lifting the contentious U.S. trade deficit with China to $24.1 billion from $17.9 billion in March.