Two small boats carrying a total of 39 North African visitors were intercepted on Monday in the Alborán Sea.
The authorities had received a call from Morocco to say that the two boats had set sail for Spain and an air and sea search was launched.
The boats were first spotted by a fishing vessel and a ferry. Upon arrival in the port of Málaga, two of the passengers were transferred to the Regional Hospital.