JAKARTA, Indonesia—Indonesia posted a surprise trade deficit of $2 billion in April, its second worst in five years, but the news was tempered by signs of increasing economic activity in Southeast Asia's largest country.

The national statistics agency said Monday that April exports fell 5.9% to $14.3 billion from the prior month, as proceeds from palm oil, which typically constitutes up to 15% of the resource-rich country's exports, slumped to about half that level.

...