By Chester Tay

Malaysia's trade surplus in August was smaller than expected, as trade with Asean countries dipped due to lower exports of crude petroleum, manufactured metal, chemicals, machinery and equipment.

Nonetheless, Malaysia's trade surplus in August still recorded a growth of 20% on an on-year basis to 13.23 billion ringgit ($3.17 billion), Malaysia's Ministry of International Trade and Industry said Monday.

The median forecast from a Wall Street Journal poll of nine economists was for a trade surplus of MYR17.95 billion. The trade surplus in July was MYR25.15 billion.

Exports in August contracted 2.9% from a year earlier, compared with the median forecast for a 4.9% growth and July's 3.1% increase.

The ministry said exports for both manufactured and agricultural goods declined, but was cushioned by higher exports of electrical and electronic products and rubber products. Manufactured goods accounted for 87% of total exports.

Malaysia's exports to China, one of its largest trading partners, expanded 21% in August, the fifth consecutive month of increase, driven by higher exports of electrical and electronic products, iron and steel products.

Exports to the U.S. in August climbed 14%, supported mainly by higher exports of manufactured goods, including optical and scientific equipment, rubber products, wood products and machinery, equipment and parts.

Compared with the month before, Malaysia's exports fell 9.8% in August.

Imports in August declined 6.5% from a year earlier, after July's 8.7% fall. The poll of economists had predicted a 4.3% decline.

Total imports were dragged by lower imports of processed industrial supplies, particularly iron and steel. The ministry said imports of capital goods also dropped in August, especially imports of parts of machinery and mechanical appliances.

Write to Chester Tay at chester.tay@wsj.com