The move comes after Spanish navy set sail in an attempt to save migrants stuck in the boat off the coast of Italy.
An Italian prosecutor has ordered the seizure of the Open Arms rescue boat that has been stranded off the coast of Italy.
The move comes just as Spain deployed a naval patrol boat to Lampedusa island on Tuesday to take the migrants off the charity rescue vessel.
The announcement came after 15 migrants jumped into the water in desperation – some without life jackets – after days on board within tantalising swimming distance of Lampedusa, against the backdrop of a major political crisis in Italy.
They were "rescued and evacuated to Lampedusa," said a spokeswoman for the NGO Proactiva Open Arms that owns the ship, on which the long wait has led to fights and suicide threats as tempers frayed.
The charity warned the situation was "out of control," with some of the migrants stuck for 19 days after being rescued at sea off the coast of Libya, many suffering from post-traumatic stress.
The Spanish patrol boat plans to escort the Open Arms charity ship back to the port of Palma in the Balearic Islands, the government said.
"After analysing various options, the Spanish government ... considers this is the most suitable."
Spanish Prime Minister Pedro Sanchez tweeted: "With this measure, Spain will solve this week, the humanitarian emergency."
The vessel has been anchored since Thursday off Lampedusa, seeking permission to dock in Italy.
There were initially 147 mainly African migrants on the ship but as the days passed, some were evacuated for medical care and all minors were allowed to disembark.
More than 80 are left on board.
Six European Union countries – France, Germany, Romania, Portugal, Spain and Luxembourg – have offered to take them all in.
But Italy's far-right Interior Minister Matteo Salvini has refused to allow migrant rescue vessels to dock as part of his hardline policies.
"Being firm is the only way to stop Italy from becoming Europe's refugee camp again," he tweeted.
Compounding his refusal is a major political crisis in Italy.
Salvini has pulled his party out of Italy's ruling coalition, hoping to topple the 14-month-old government and trigger early elections, which polls suggest his anti-immigrant League party and its right-wing allies could win.
On Tuesday, Italian Prime Minister Giuseppe Conte announced he would resign.
Spain slams Italy
Faced with Italy's protracted refusal to allow the migrants to disembark, Spain at the weekend offered up its southern port of Algeciras, which the NGO said could "not be achieved" due to the distance and tensions on board.
Madrid then offered up Mallorca in the Balearic Islands, nearer but still around 1,000 kilometres (600 miles) from Lampedusa.
The charity described this offer as "totally incomprehensible" and continued to demand the ship be allowed to dock in Lampedusa.
Spain's Defence Minister Margarita Robles has slammed Italy – and particularly Salvini – for the situation.
"What Salvini is doing in relationship with the Open Arms is a disgrace to humanity as a whole," she said Monday.
Salvini "has shown he doesn't care about human lives", she added Tuesday.
A reporter with the Spanish public broadcaster TVE reporting from the NGO boat said that the first man who jumped into the sea refused to return to the Open Arms ship and was brought to the Italian island of Lampedusa instead, apparently triggering the reaction of the nine who followed his lead.
The reporter said that those jumping were "desperate and going mad" after 19 days trapped on board.
Open Arms said that the Italian coast guard managed to rescue all of them, but it was not immediately clear if they would also be taken to land.
Live video showed people wearing life vests floating in the sea, some in groups some individually, with a coast guard vessel nearby and rubber dinghies trying to reach them.
Open Arms confirmed that the first man who jumped was a Syrian national. The group said the man threw himself into the water, trying to reach the land that was in plain view, while at the same moment a woman suffered a panic attack.
The Open Arms captain previously informed Italian authorities that the crew of 17 can no longer control the situation on board, as frustrated migrants resort to fighting.