The U.S. trade deficit shrank in February as both imports and exports fell, according to a government report on Tuesday that suggested a slowdown in global demand.

The monthly trade gap totaled $45.8 billion, down from an upwardly revised estimate of $47.0 billion in January. Analysts surveyed before the report had expected the deficit to narrow to $44.5 billion, from the previously reported January tally of $46.3 billion.

U.S. exports, after rising in each of the previous five months, fell 1.4 percent in February to $165.1 billion. That was led by a $1 billion drop in auto and auto parts exports, with smaller declines for other major categories. Services exports rose just enough to set a record.

U.S. imports, which like U.S. exports have roared back from the depths of the global financial crisis in 2008 and 2009, fell a larger 1.7 percent in February to $210.9 billion.

Automotive imports fell $2.3 billion, followed by a $2.1 billion drop in capital goods. Imports of consumer goods rose $2.3 billion in February.

The average price for imported oil rose for the fifth straight month in February to $87.17 per barrel, the highest since October 2008. But that was tempered by the lowest quantity of crude oil imports since February 1999.

The closely watched U.S. trade deficit with China shrank 19 percent in February to $18.8 billion, as U.S. imports from that country fell and U.S. exports to the Asian manufacturing giant rose.

While Beijing could point to the smaller trade gap as a sign its economy was becoming less reliant on exports, the U.S. trade deficit with China was still 21 percent higher for the first two months of the year.

China's own trade figures released earlier this week showed that in the first quarter of 2011 it ran an overall trade deficit for the first time since 2004. (Reporting by Doug Palmer, Editing by Andrea Ricci)