The U.S. trade deficit fell by 14.9 percent from April through June, the biggest improvement in more than five years, the government reported Wednesday.

The Commerce Department said that a record level of U.S. exports and the first quarterly decline in imports in three years pushed the deficit down to $29.9 billion in the second quarter.The deficit was below the $35.2 billion imbalance in the first three months of the year. Both quarters were below the $41.2 billion deficit in the fourth quarter of 1987.

The 14.9 percent drop represented the biggest decline since the fourth quarter of 1982, when the imbalance fell by 18.9 percent.

The new figures confirmed an improvement that had already shown up in the department's monthly merchandise trade reports. Those figures showed a 12.8 percent drop in the deficit to $32.6 billion in the second quarter, compared to $37.4 billion in the first quarter.

U.S. exports rose $4.4 billion to a record $79.7 billion in the second quarter. Sales of both farm and non-farm products rose during the quarter as the decline in the value of the dollar continued to make American goods competitive on foreign markets.

Agricultural exports rose 7 percent to $9.7 billion, the highest level since the second quarter of 1984, reflecting in part a jump in prices.

The trade deficit decreased with every major geographic area with the exception of Canada, the country's largest trading partner. The Canadian deficit rose by $500 million to $4.1 billion.