The U.S. trade deficit narrowed unexpectedly in November as exports climbed to the highest level in more than two years, government data showed on Thursday.

The trade gap dipped to $38.3 billion from $38.4 billion in October, the Commerce Department reported. Analysts surveyed before the report had expected the November trade deficit to widen slightly to $40.5 billion from October's originally reported $38.7 billion.

November's deficit was the lowest since January 2010.

November's exports of goods and services totaled $159.6 billion, the highest since August 2008, which was just weeks before the bankruptcy of Lehman Brothers touched off a trade-crushing global panic.

November exports to China, at $9.5 billion, were the highest on record. Despite the export gain, the politically sensitive trade gap with China widened to $25.6 billion in November from $25.5 billion in October. Imports from China rose to $35.1 billion, from $34.8 billion a month earlier.

These figures will probably feature prominently in the run-up to next week's U.S.-China leaders summit at the White House. The United States wants China to allow its yuan currency to rise more rapidly in order to help shrink the trade gap.

(Reporting by Emily Kaiser, Editing by Chizu Nomiyama)