The boat capsized shortly after midnight about 3.7 kilometres from shore on the outskirts of Kuala Lumpur while trying to leave Malaysia illegally for Aceh province in Indonesia, maritime agency official Mohamad Hambali Yaakup said.
Tens of thousands of Indonesians work without legal permits in plantations and other industries in Malaysia, and they travel between the countries by crossing the narrow Strait of Malacca, often in poorly equipped boats.
Hambali said survivors were rescued at sea and found on land after swimming to safety; they included 12 women and a child. Those dead were a woman and four men, he added.
The survivors were being questioned by police and immigration authorities, and Indonesian embassy officials were also on the scene. A rescue department photo showed about two dozen survivors, who had little belongings with them, sitting outside a building.
Also Read
A ship, eight boats and a helicopter were searching for further survivors.
Police Superintendent Azman Abdul Razak said 100 personnel were involved in the rescue effort.
Hambali said authorities are still investigating why the boat sank but rough seas and an overloaded boat could have been factors. Some survivors also claimed the boat was leaking, he said, and police told local media the boat capsized during a storm.
The boat's capacity was 50-60 people, but it was believed to be carrying 97. Hambali said some survivors may have swum to shore and gone into hiding.