Spain has offered to take in a migrant rescue ship a day after it was denied permission to dock by both Italy and Malta, according to a statement by the prime minister's office.
The mayors of Barcelona and Valencia offered their ports to receive the charity-run rescue ship with 629 migrants on board, including 123 unaccompanied minors and seven pregnant women.
Medical workers on the ship say it will run out of food by the end of Monday.
Barcelona Mayor Ada Colau has offered her city's help while criticizing other Europeans, saying the crisis over the Aquarius "puts in question" the unity of the European Union.
She says "the duty of a democratic government is not to look away" in a humanitarian crisis.
Colau called on the new Spanish government, now led by the Socialist party, to change migration policies set by the previous conservative administration.
The country's new Prime Minister Pedro Sanchez responded quickly to the call to action, giving instructions for the boat to be admitted to the 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," the statement said.
Meanwhile, Italian Interior Minister Matteo Salvini said getting Spain to take in a migrant rescue vessel that was refused entry by Italy and Malta is a great victory
"Clearly, politely raising our voice — something that the Italian government had not done for a long time, for years — pays," Salvini said from the headquarters of his far-right League party.
Making a point that migrants plucked from the Mediterranean should not all automatically go to Italy "is a first important signal" towards a new European immigration policy, he added.
Salvini said that he plans telephone conversations with French, German, Austrian, Belgian and Dutch counterparts on Tuesday to pursue the issue.
Doctors Without Borders, which has staff aboard the SOS Mediterranee rescue ship Aquarius, said food and water would run out by Monday night and that some of the passengers were suffering from water in their lungs as well as chemical burns caused when gasoline mixes with seawater.
"The men, women and children aboard the Aquarius have risked their lives on perilous seas to escape horrific abuses in Libya only to find themselves caught in an unconscionable political stand-off between two European states," said Amnesty International, accusing both Italy and Malta of "turning their backs" on their international obligations.
But the two countries held firm with Salvini clearly using the high seas drama as the pretext to force the hand of Italy's European neighbors. Italy has long demanded that the EU change its migration policy and make good on promises to accept more refugees, saying Italy has been left alone to coordinate rescues and accept the migrants for asylum processing.
"Enough!" Salvini said Monday. "Saving lives is a duty, but transforming Italy into an enormous refugee camp isn't."
He tweeted: #Chiudiamoiporti. "We're closing the ports."
Italy says Malta should accept the Aquarius because Malta is the safest, closest port. Malta says Italy coordinated the rescue and that it has had nothing to do with it.
Maltese Premier Joseph Muscat accused Italy of violating international norms governing sea rescues and said its position risks "creating a dangerous situation for all those involved."
As the rhetoric intensified, the Aquarius remained on standby in the Mediterranean Sea. The ship said it had been ordered by Italy's coast guard coordination center late Sunday to remain 35 miles off Italy and 27 miles from Malta, and there it remained Monday.
The migrants had been rescued in the Mediterranean during a series of operations Saturday by Italian maritime ships, cargo vessels and the Aquarius itself. All passengers were offloaded to the Aquarius to be taken to land.
Amid the firm "no" from Italy's national government, several Italian mayors offered to let the ship dock in their ports, including the left-leaning or centrist mayors of Naples, Reggio Calabria and Crotone.
Dr. David Beversluis, one of the doctors aboard the ship, said there were no medical emergencies aboard but one passenger had to be revived after he was rescued.
"When the boat broke, a man sank in front of the eyes of the rescuers, who managed to catch him and revive him once out of the water. He is now out of danger," Beversluis said. "All the survivors are exhausted and dehydrated because they spent many hours adrift in these boats."
Almost a quarter of the survivors hail from Sudan, the group said.
Doctors Without Borders tweeted a video of some of the women aboard the ship praying Monday morning and said they were unaware of the diplomatic fight being waged over their fate.
"Thank you Lord," the women sang. The group said it "urgently requests a swift resolution and a designated port of safety."
The standoff marked the first inevitable clash over migrant policy with League leader Salvini, now running Italy's interior ministry. Salvini campaigned on an anti-immigrant platform that also included a vow to expel hundreds of thousands of migrants already in Italy, even though experts doubt such mass deportations are feasible or financially viable.
Malta, for its part, has consistently refused to take in migrants, citing its small size and limited capacities.
The island nation has progressively reduced the number of migrants it has taken in over the past decade, from a high of 2,775 in 2008 to just 23 last year, according to U.N. statistics.
Salvini pointed to Malta's unwillingness in accusing Europe as a whole of leaving Italy on its own to deal with the refugee crisis. He noted that other European countries are very much involved in current rescue operations in the Mediterranean — including a German aid group currently off Libya — but no country is stepping up to actually take in the migrants.
"Italy has stopped bowing our heads and obeying," Salvini said in a Facebook post. "This time we say no."
The standoff is actually the third in recent weeks, after the outgoing government of Premier Paolo Gentiloni refused to let humanitarian aid groups dock in Italian ports until the ships' flag nations had formally requested permission. Those incidents delayed the migrants' arrival, but they ultimately made it to Italy.