(CNN)A ship carrying more than 300 migrants rescued off the coast of Libya last week arrived in Spain on Friday.
The rescue vessel, operated by the Spanish charity Proactiva Open Arms, had earlier been denied entry by Italy and Malta, the charity said.
The charity said the migrants -- mainly from Somalia, Nigeria and Mali -- were in three separate boats "in danger of shipwreck" when they were found on December 21.
The ship docked at a port near Algeciras in southern Spain on Friday morning.
"Open Arms is already in the Bay of Gibraltar and is steering towards the only port available to it in the Mediterranean. Mission accomplished," the charity's founder, Oscar Camps, tweeted Friday.
A woman and her newborn baby were airlifted from the boat to Malta during the journey, while a teenager with a skin infection was taken to Italy, the charity said.
"There are only 2 bathrooms. We're on the high seas. There's no medicine, blankets. Basic food only for 2 or 3 days," the charity tweeted last Saturday.
On Christmas Eve, the charity had posted videos and pictures of the migrants singing and wearing Santa hats.
On Friday, Matteo Salvini, Italy's hardline anti-immigrant Interior Minister, tweeted: "NGO ship #OpenArms just docked in Spain with 310 undocumented migrants on board. Mission accomplished! #closedports".
Salvini closed Italian ports to migrant boats in June. After Proactiva Open Arms requested permission to dock in Italy last week, he tweeted: "Italian ports are CLOSED! For the traffickers of human beings and for those who help them, the good times are over".
Camps, the Proactiva founder, replied: "Matteo Salvini, your rhetoric and your message, just like everything in this life, will end. But know that in a few decades your descendants will be ashamed of what you do and what you say."
The Spanish Coast Guard said Friday that it had rescued 260 migrants in the Alboran Sea during the past 24 hours.
A spokeswoman for the Coast Guard said the migrants were from Morocco and sub-Saharan Africa and have been taken to the Spanish port cities of Malaga, Almeria, and Motril.
More than 1,300 migrants have died this year while trying to reach Italy or Malta, according to the International Organization for Migration (IOM).
A United Nations report last week said migrants attempting to cross the Mediterranean face "unimaginable horrors," blaming "a local and international failure to handle this hidden human calamity."