The Commerce Department said on Friday the trade deficit slipped 0.3% to $55.2 billion. Data for May was revised slightly to show the trade gap widening to $55.3 billion instead of the previously reported $55.5 billion.
Economists polled by Reuters had forecast the trade gap would shrink to $54.6 billion in June.
The goods trade deficit with China decreased 0.8% to $30.0 billion, with imports falling 0.7%. Exports to China were unchanged in June. President Donald Trump on Thursday escalated the trade war with China, announcing an additional 10% tariff on $300 billion worth of Chinese imports starting Sept. 1 after negotiators failed to kick-start trade talks between the world's two largest economies.
The US-China trade tensions have caused wild swings in the trade deficit, with exporters and importers trying to stay ahead of the tariff fight between the two economic giants. The trade deficit with Mexico was the highest on record in June.
In June, goods imports fell 2.2% to $212.3 billion. Imports of consumer goods fell $0.9 billion, pulled down by a $1.4 billion drop in imports of cellphones. Crude oil imports declined $1.4 billion, reflecting cheaper oil.
Goods exports fell 2.8% to $137.1 billion. Exports of consumer goods fell $1.9 billion. There were also decreases in exports of capital goods and motor vehicles.
When adjusted for inflation, the goods trade deficit fell $0.3 billion to $86.1 billion in June. The government reported last week that trade cut 0.65 percentage point from gross domestic product in the second quarter. The economy grew at a 3.1% rate in the April-June quarter.