The row has triggered international concern about the migrants' plight.
The refusal to accept the Aquarius in Italy was the first major anti-migrant move since far-right Interior Minister Matteo Salvini took office this month.
But Spain's new Socialist Prime Minister Pedro Sanchez agreed to allow the Aquarius to dock in its eastern port of Valencia, his office said in a statement.
"It is our obligation to help to avoid a humanitarian catastrophe and to offer a safe port to these people," his office said in a statement.
SOS Mediterranee director general Sophie Beau said Spain's offer "is encouraging and shows that some states are sensitive to the humanitarian emergency." She warned that the ship will have to travel some 1,300 kilometres (800 miles) to reach the Spanish coast and that by tomorrow "there will be no more food (on board) apart from energy biscuits."
Malta's Prime Minister Joseph Muscat said in a tweet that "Malta is going to send fresh supplies to the ship." Italy and Malta thanked Spain for stepping up, but maintained their dispute over who was responsible.
"We asked for a gesture of solidarity from Europe and this gesture has been made," Italy's Prime Minister Giuseppe Conte said.
Muscat tweeted his thanks to Sanchez "for agreeing to accept the Aquarius after Italy violated international law and caused an impasse." He added: "It will be necessary to sit down and discuss how to prevent this kind of thing from happening in the future. This is a European issue."
Beau said that under maritime law the ship should be allowed to dock in one of the nearest countries, Italy or Malta.
The UN had called on Malta and Italy to immediately allow the boat to dock, describing the situation as "an urgent humanitarian imperative".
The EU and the bloc's biggest member state Germany made similar pleas. "The priority of both the Italian and Maltese authorities should be ensuring these people receive the care they need," European Commission spokesman Margaritis Schinas told reporters, calling for a "swift resolution".
Salvini refused to back down.
"Saving lives is a duty, turning Italy into a huge refugee camp is not. Italy is done bending over backwards and obeying, this time THERE IS SOMEONE WHO SAYS NO," he wrote on Twitter followed by the hashtag #closethedoors.
MSF Sea (Doctors Without Borders) said the medical situation of those on the Aquarius was "stable for now but unnecessary delay to disembarkation in safe port puts vulnerable patients at risk." "Particularly seven pregnant woman, 15 with serious chemical burns and several critical drowning hypothermia patients," MSF Sea said.
Conte said Sunday that Rome had sent two patrol ships with doctors on board "ready to intervene and ensure the health of anyone on board the Aquarius who might have the need".
The migrants were rescued in six separate night-time operations in the central Mediterranean on Saturday.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)
Business Standard has always strived hard to provide up-to-date information and commentary on developments that are of interest to you and have wider political and economic implications for the country and the world. Your encouragement and constant feedback on how to improve our offering have only made our resolve and commitment to these ideals stronger. Even during these difficult times arising out of Covid-19, we continue to remain committed to keeping you informed and updated with credible news, authoritative views and incisive commentary on topical issues of relevance.
We, however, have a request.
As we battle the economic impact of the pandemic, we need your support even more, so that we can continue to offer you more quality content. Our subscription model has seen an encouraging response from many of you, who have subscribed to our online content. More subscription to our online content can only help us achieve the goals of offering you even better and more relevant content. We believe in free, fair and credible journalism. Your support through more subscriptions can help us practise the journalism to which we are committed.
Support quality journalism and subscribe to Business Standard.