A coastguard vessel spotted the troubled boat just after midday, some 39 nautical miles (72 kilometres) northwest of the town of Al Hoceima in northern Morocco.
Two women and 13 men were clinging to what was left of the boat, which had lost its base.
“One of the rescued women said the boat had lost its floor at around two in the morning, and many people who were travelling it were lost,” the statement said.
“According to the numbers provided by the rescued migrants, the boat was carrying 54 people, so 39 may be missing.”
The 15 rescued migrants were being transported by the coastguard ship to the southern Spanish port of Malaga.
Another coastguard vessel backed by two helicopters was searching for the missing migrants.
— SALVAMENTO MARÍTIMO (@salvamentogob) October 29, 2015
The coastguard began looking for the stricken boat after receiving a call on Thursday from an NGO which warned that a vessel loaded with migrants had departed from a beach near Al Hoceima.
Last year Spanish authorities picked up 3,500 migrants trying to cross from Morocco by boat, a 55 percent increase over 2013.
This year alone, more than 3,000 people have died while trying to make the perilous journey to Europe across the Mediterranean. More than half a million people have made the voyage in Europe's worst migration crisis since World War II.