The U.S. trade deficit narrowed unexpectedly in September to its lowest since May 2005 as exports set a record, according to U.S. Commerce Department data on Friday.

The trade gap shrank to $56.5 billion in September, down slightly from a revised estimate of $56.8 billion for August despite a record high price for imported oil.

Wall Street analysts had pegged the trade deficit at $58.5 billion in September, up from the Commerce Department's initial estimate of $57.6 billion for August.

The report was more proof that a weak U.S. dollar is boosting exports of goods and services, which rose for a seventh consecutive month to a record $140.1 billion.

U.S. exports to Canada, Mexico, France, Germany, China and Japan all show gains through the first nine months of 2007.

Exports to the European Union have risen 16.5 percent to $183.8 billion through September, helping reduce the trade gap with the economic bloc by 12.7 percent.

A Labor Department report on Friday showed that soaring global oil costs helped drive U.S import prices higher in October at the steepest rate in nearly 1-1/2 years.

Overall U.S. imports rose slightly in September to $196.6 billion, just shy of the record set in July 2007. Imports from China and from the Organization of Petroleum Exporting Countries were both the second highest on record. (Editing by Neil Stempleman)