Nearly 140 migrants who had been stranded on a boat at a port in Sicily were allowed to disembark early on Sunday after Ireland and Albania agreed to take some of them in.
The boat docked at Catania port on Monday but Italy had refused to let those on board disembark in the absence of any EU commitment to relocate them, prompting a new bitter row with Brussels.
But following a deal brokered by the Catholic Church late on Saturday, Italy's far-right Interior Minister Matteo Salvini agreed to allow them to leave the Diciotti, the Italian coastguard ship which rescued them some 10 days ago.
There were initially around 180 migrants on board when it arrived at Catania, but Rome allowed 27 unaccompanied minors to disembark on Wednesday and another 12 people left on Saturday following a health authority request.
Albania, which is not a member of the EU, offered safe haven to 20 of the migrants, with Ireland saying it would take up to 25.
It was not immediately clear what would happen to the others, although Italian media reports suggested Rome was in talks with Serbia and Montenegro.
The migrants disembarked several hours after Sicilian prosecutors said they had opened an inquiry into Salvini for "illegal confinement, illegal arrest and abuse of power" over his refusal to authorise their disembarkation, reports said.
EU migration commissioner Dimitris Avramopoulos welcomed the deal, saying it was the result of "solidarity across borders and communities".
"But we cannot always wait for this type of goodwill solidarity. We need to have structural measures," he said in a statement.- A warning to Italy -
The Diciotti standoff was the latest in a string of incidents involving Italy's recently-installed populist government, which has vowed to stop taking in migrants rescued off Libya.
On Friday, Rome threatened to pull its EU funding unless other states agreed to take some of the Diciotti migrants.
But Avramopoulos warned Italy would end up "shooting itself in the foot" by its ongoing attacks on the EU.
"Politicians in your country need to understand that you are not alone, that Europe is trying to help you. On the contrary, anyone who attacks the EU is shooting himself in the foot," he told Sunday's edition of La Repubblica newspaper.
"We cannot move ahead with ad hoc solutions for each boat. The migration phenomenon is not going to stop overnight so we need to manage it together as one European family."
Italy's economy minister Luigi Di Maio, however, remained defiant, saying Rome would be within its rights to hold back its annual EU budgetary contributions.
"If their system of solidarity works like that, we will not give another euro to the EU," he said in a televised interview.
- 'Once we were Eritreans' -
Writing on Twitter late Saturday, Albania's Foreign Minister Ditmir Bushati said Tirana was "ready to help", recalling how Italy accepted thousands who fled Albania by sea after the fall of communism in the early 1990s.
"We cannot replace Europe but we are always here, on the other side of a sea where once we were the Eritreans suffering for days and nights in the middle of the sea, waiting for Europe to wake up," he said.
"Yesterday, Italy saved us, today we are ready to give a hand."
And Ireland's Foreign Minister Simon Coveney tweeted that Ireland would "accept 20-25 migrants from the Diciotti".
"European solidarity is important + this is the right thing to do. Work continues (with) EU partners on more sustainable solutions."
- Race to the bottom -
Migration is a hot-button issue in Italy, where hundreds of thousands of people have arrived since 2013.
Under EU rules people must seek asylum in their country of arrival, but Rome has recently moved to block boats from docking at its ports.
UN High Commissioner for Refugees Filippo Grandi had on Friday rebuked European nations over the standoff.
"The time has come to end the back-and-forth that has seen countries competing in a race to the bottom on who can take the least responsibility for people rescued at sea," he said.
"It is dangerous and immoral to put the lives of refugees and asylum-seekers at risk while states engage in a political tug-of-war on long-term solutions."