The U.S. trade deficit narrowed in April, as both imports and exports fell from record high levels set in March, in a sign of slowing global demand, a government report showed on Friday.

The gap shrank 4.9 percent to $50.1 billion, as imports of goods and services dropped 1.7 percent to $233.0 billion, the U.S. Commerce Department said.

Exports slipped 0.8 percent to $182.9 billion. Both imports and exports were still the second highest on record.

Wall Streets analysts surveyed before the report had expected a slightly smaller trade gap of $49.5 billion.

U.S. exports to the 27-nation European Union, in the grip of a continuing debt crisis that has slowed growth on the continent, fell 11.1 percent in April to $22.3 billion.

The EU collectively was the United States' second largest export market last year, and exports in the first four months of 2012 were 3.5 percent above the same period in 2011 despite the downturn in April.

U.S. exports to China, which is also growing more slowly than in recent years, fell 14 percent in April. China has been one of the fastest growing markets for U.S. goods, and exports to that country were up 4.3 percent for the first four months of 2012.

The drop in exports in April mainly reflected less foreign demand for capital goods and industrial supplies and materials.

U.S. imports fell despite an increase in the average price of imported oil to $109.94 per barrel, the highest since August 2008. The volume of oil imports also rose slightly to 9 million barrels per day.

U.S. imports from the EU slipped 11.1 percent to $31.0 billion, while imports from China rose 4.8 percent to $33 billion.