The U.S. trade gap narrowed unexpectedly to $26 billion in May, the smallest since November 1999, as exports rose and domestic demand for foreign goods slumped, government data on Friday showed.

The Commerce Department said exports increased 1.6 percent in May, while imports declined by 0.6 percent. Economists said the drop in imports signaled continued weakness in the recession-mired U.S. economy.

The trade deficit report is another indicator that things are not improving as expected, said William Larkin, portfolio manager with Cabot Money Management in Boston. There is growing pessimism about how quickly the U.S. will recover, which I think will be slower than people expect.

Still, the stronger-than-anticipated export performance could bolster the contribution of trade to economic activity in the second quarter.

If the real trade deficit in June remains unchanged, real net exports would add about two percentage points to GDP growth in the second quarter, everything else equal, Jay Bryson, global economist at Wells Fargo Securities, said in a note to clients.

The U.S. economy plummeted at a 5.5 percent annual rate in the first three months of the year. Economists expect a much smaller decline in the second quarter, with growth resuming in the second half of the year.

Analysts polled by Reuters had expected the trade deficit to widen to $30.2 billion in May. The trade gap in April was revised to $28.8 billion.

May's import level was the lowest since July 2004 and May marked the tenth straight month in which imports had declined, underscoring the weakness in the U.S. economy.

Imports of automotive vehicles and parts slipped to $10.2 billion in May, the lowest level since March 1996, while auto exports were the lowest since July 1998.

The monthly deficit on goods trade with China grew to $17.5 billion from $16.8 billion in April and was the largest with any single country.

But the U.S. trade deficit with other big trading partners declined, falling to $2.8 billion with the European Union in May, for the lowest reading since March 1999, and retreating to $1.9 billion with Japan, which was the lowest since February 1984.

Imported oil cost $51.21 a barrel in May, up from $46.60 in April. The value of crude oil imports in May declined only slightly to $13.4 billion, despite a sharper decline in the quantity of oil imported, to 262 million barrels from 293 million in April, the Commerce Department said.

The increase in oil prices was a factoring driving import prices higher in June, Labor Department data showed.

The Labor Department said import prices jumped 3.2 percent last month, the biggest jump since November 2007, while export prices were up 1.1 percent.

Import prices have risen for four consecutive months, but are still down for the year ended in June, largely because of oil prices are well off record highs reached last year.

Petroleum prices rose 20.3 percent in June, the largest monthly advance since April 1999. However, these prices are down 45.9 percent over the past 12 months.

(Additional reporting by Emily Kaiser and John Parry; Editing by Neil Stempleman)

(Reporting by Alister Bull, Editing by Neil Stempleman)