The trade deficit narrowed 5.6 percent in May to $44.4 billion after hitting a two-year high of $47 billion in April, the Commerce Department reported Thursday.
Exports of goods and services rose 1 percent to a record $195.5 billion in May while imports fell a slight 0.3 percent to $239.8 billion.
A lower trade deficit boosts overall economic growth when it shows US companies are earning more in their overseas sales. Economists are looking for a smaller trade deficit in the April-June quarter which will mean less of a drag on overall growth than in the first quarter, when the economy shrank at an annual rate of 2.9 percent.
Paul Dales, senior US economist at Capital Economics, said he looked for the trade deficit to be just about half of the 1.5 percentage point drag it represented in the first quarter.
Many analysts are looking for overall growth to rebound to a healthy rate between 3 percent and 3.5 percent in the second quarter.
In 2013, the trade deficit declined 11.3 percent to $476.4 billion. That reflected in part a boom in US energy production that cut into America's dependence on foreign oil while boosting US petroleum exports to a record high.
The larger trade gap in the first three months of this year, compared to the fourth quarter, shaved 1.5 percentage points from growth. That was a big factor in helping to push the economy into reverse. In addition to a higher trade deficit, the economy was held back by severe winter which dampened consumer spending.
In May, the US trade deficit with China rose 5.4 percent to $28.8 billion. Through the first five months of this year, America's deficit with China is running 3.2 percent ahead of last year's record pace.
The rise in exports reflected record sales of US-made autos and auto parts and an 11.3 percent jump in exports of US petroleum products. The rise in US production has helped lower the need for imported oil, which dropped by 5 percent in May to $28.3 billion, the lowest monthly import total since November 2010.
Total US exports to Canada were the highest on record while imports from Canada were the highest since July 2008, leaving a trade deficit of $2.8 billion with Canada. America had a record $2.7 billion trade deficit with South Korea in May as imports from that country hit a record high.
Obama administration officials will meet with their Chinese counterparts in Beijing next week for annual high-level talks covering economic and foreign policy issues. Previewing the discussions on Tuesday, Treasury Secretary Jacob Lew said the Obama administration would push China to allow its currency to rise against the dollar. The Chinese yuan has declined by about 2.4 percent against the dollar so far this year.
American manufacturers contend the Chinese currency is undervalued by as much as 40 percent and the Chinese government is manipulating the value to gain trade advantages. A weaker yuan makes Chinese goods cheaper in the United States and US products more expensive in China.
Lew said that computer security would be another issue discussed. In May, the Justice Department charged five Chinese military officers with hacking into US companies' computer systems to steal trade secrets.