"Finally, the nightmare ends and 83 people on board will receive immediate assistance on land," Open Arms said on Twitter. Hours later, migrants and crew celebrated as the rescue ship docked in Lampedusa. The migrants then walked one- by-one down a gangplank to land.
The rescued passengers have been on the Spanish-flagged charity ship since they were plucked from the Mediterranean 19 days ago.
Even after six countries stepped forward to take the migrants and Italy's governing coalition imploded partly because of the crisis, Salvini had refused to open Italian ports.
The minister staved off previous investigations resulting from other migrant standoffs and tweeted that he wasn't worried about the prospect of criminal charges.
"I am not afraid, I am proud to defend the borders and security of my country," Salvini wrote.
Until the action by the Italian prosecutor, the Spanish move was the first concrete signal promising an end the humanitarian crisis involving the Open Arms.
"After analyzing all the options, this is the most adequate and the one that would allow resolving within this week the humanitarian emergency on board the Open Arms," the Spanish government said in a statement.
The migrants on the Open Arms were tantalizingly close to Lampedusa but forbidden by Salvini to disembark. The captain had previously told Italian authorities the crew of 17 was no longer able to maintain control, and they described the situation as "desperate."
After one Syrian national jumped and was rescued and brought to shore on Lampedusa, two more groups followed his lead. They were likewise ferried to land and spared a return to the ship.
Video showed people in life vests floating in the sea, some in groups and some individually, with a coast guard vessel nearby and rubber dinghies maneuvering to pluck them to safety.
Dozens of others have been evacuated in recent days for medical reasons or because they are minors. Officials said tensions on board were running high, with fights breaking out among the migrants.
The temporary confiscation of the rescue ship by the prosecutor "is a cost that Open Arms assumes to secure that the people on board can be assisted," said the Spanish NGO's founder, Oscar Camps, on Twitter.
"We consider indispensable prioritizing their health and security in this humanitarian emergency," he wrote.
Spain said it would take three days for its navy ship, the Audaz, to reach Lampedusa from the Spanish port of Rota, and it wasn't immediately clear how long it would take to escort the smaller Open Arms vessel to the Spanish island of Mallorca, where it is set to dock in Palma de Mallorca.
Emilio Damiá Marqués, the commander of the Audaz, told Spanish public broadcaster TVE from Rota that his ship, carrying 62 people including a doctor, expected to arrive at the Italian island by Friday afternoon.
Italian Transport Minister Danilo Toninelli welcomed Spain's move to help resolve the crisis involving the Open Arms, operated by a nongovernmental humanitarian agency.
"Good news, finally the by-now unsustainable situation on board the NGO ship could have a solution that protects the people on board for 19 days by now, and not leave Italy alone," he said.
The Open Arms sailed within a few hundred meters of Lampedusa last week after Salvini's ban on private rescue boats entering Italy's waters was overturned by a court. Salvini has appealed the ruling and warned that his ban on docking still held.
Meanwhile, the Norwegian-flagged Ocean Viking, which is operated by two French humanitarian groups and has 356 rescued migrants aboard, has been sailing between Malta and the Italian island of Linosa as it waits for a port of safety to be assigned.
Italy's standoff over the Open Arms has further raised tensions in the country's failing ruling coalition, as Cabinet members from the 5-Star Movement, including the defense and transport ministers, increasingly question the actions over the migrants by Salvini, leader of the right-wing League party.
Toninelli said other European countries were turning their backs on Italy "and there is one person responsible: Matteo Salvini, who has weakened the government and as a consequence our position in Europe."
Parra reported from Madrid.