Updated

The U.S. trade deficit (search) unexpectedly shrank for the fifth consecutive month in August, as imports of cars and auto parts fell to their lowest level in 20 months, the U.S. Commerce Department (search) said on Friday.

The trade gap totaled $39.2 billion, down from a revised tally of $40.0 billion in July and the lowest level since February. Analysts surveyed before the report had forecast the August trade deficit to expand to $41.3 billion.

U.S. trade in the services sector set new records in August on both the import and export side.

The data showing that the United States' ominously large trade deficit was starting to shrink gave the dollar a boost against the yen and the euro in early trading.

That "makes sense because people will be revising up their GDP estimates, but ultimately the trade data is not a favorable sign of (economic) activity," said Marcel Kasumovich, head of G10 foreign exchange strategy for Merrill Lynch in New York.

The trade deficit shrank because global activity was "terrible", he said, adding "The other caveat is that civilian aircraft orders (search) -- exports and imports -- were both down."

The massive power outage on the U.S. East Coast and Canada in August also had an impact on the trade figures, analysts said.

The trade deficit with China hit a monthly record at $11.7 billion - the biggest the United States has with any single country. Imports from the Asian manufacturing giant were also a record at $13.7 billion.

Overall U.S. imports fell 2.5 percent to $122.9 billion -- led by a $2.3 billion drop in imports of automotive vehicles, parts and engines -- to their lowest level since January 2002. Imports of consumer and capital goods also declined, with other major categories virtually unchanged.

U.S. exports retreated 2.7 percent to $83.7 billion, but remained at a relatively high level. U.S. exports of cars and auto parts fell $700 million to their lowest level since December 2001. Exports of capital goods and industrial supplies and materials also were lower.

"I think exports were affected partly due to the power shutdown, so you had a decline in exports," said Asha Bangalaore, an economist with Northern Trust in Chicago.