The U.S. monthly trade deficit unexpectedly shrank in June to $56.8 billion, a much narrower deficit than the -$62.0 billion balance expected by markets. May's deficit figure was upwardly revised to $59.2 billion from a previously reported $59.8 billion, the U.S. Census Bureau reported Tuesday.

Total June exports were $164.4 billion, while imports were $221.2 billion, resulting in a goods and services deficit of $56.8 billion. June exports were $6.4 billion more than May exports of $158.0 billion, and June imports were $3.9 billion more than May imports of $217.2 billion.

In June, the goods deficit decreased $2.1 billion from May to $70.0 billion and the services surplus increased $0.4 billion to $13.3 billion. Exports of goods increased $5.7 billion to $116.7 billion, and imports of goods increased $3.6 billion to $186.7 billion. Exports of services increased $0.7 billion to $47.7 billion, and imports of services increased $0.3 billion to $34.5 billion.

Prior to the release, economists had said a rise in the nominal and real value of oil would cause the monthly deficit to deteriorate.

By Patrick McGee and edited by Megan Ainscow