"Total May exports of $183.1 billion and imports of $231.8 billion resulted in a goods and services deficit of $48.7 billion, down from $50.6 billion in April," the monthly report by the Commerce Department's Census Bureau and Bureau of Economic Analysis said.
Record exports were reported in total services, at $52.4 billion, as well as in the foods, feeds and beverages category, which came in at $11.8 billion.
Exports of U.S. goods and services through the first five months of 2012 were up 5.7 percent, or $48.6 billion, from the same period of 2011 to reach $908.7 billion.
"U.S. exports posted their second-highest level on record in May despite some tough economic conditions abroad, confirming the progress we are making on the path to achieving the president's goal of doubling exports by the end of 2014," Acting U.S. Commerce Secretary Rebecca Blank said in a statement.
The Wall Street Journal said the easing in the trade gap was in line with Wall Street expectations.