EU foreign ministers have agreed to launch a mission in the Mediterranean to enforce a UN arms embargo on Libya, which has been routinely flouted.
It comes after hours of intense talks between ministers in Brussels on Monday.
The naval and air mission in the eastern Mediterranean is aimed at stopping more weapons reaching warring factions in Libya.
The decision marked a breakthrough after weeks of fruitless negotiations and warnings by EU foreign affairs chief Josep Borrell that the bloc risked becoming irrelevant if it could not act.
“When you have political will nothing is impossible,” Mr Borrell said at the conclusion of talks in Brussels.
He said the new mission in the Mediterranean to replace the EU's migration focused Operation Sophia would include aerial and satellite monitoring as well as naval forces.
"We all agree to create a mission that blocks the flow of arms into Libya," Italian Foreign Minister Luigi di Maio said after the meeting.
The UN arms embargo was imposed in 2011.
Earlier in the day, other ministers had struggled to convince Austria to lift its objections.
The EU's military mission stopped sending ships last March after Italy said it would no longer take in migrants rescued at sea.
But last week, Italy's vice foreign minister said Rome was ready to restart the sea patrols.
Austria had been blocking the move, saying people rescued at sea should not be taken to Europe.
In a compromise, EU ships will now hail and inspect suspicious vessels in the eastern Mediterranean, where most arms smuggling takes place, away from migrant routes.
Austria's Foreign Minister, Alexander Schallenberg, said that was acceptable but Vienna would still be vigilant for any signs that the mission, which will take weeks to set up, was attracting migrants into Europe.
Initially, Mr Borrell had hoped to revive the EU's current military mission, known as Operation Sophia.
One compromise was to use aircraft, rather than ships, to monitor smugglers who supply Libya's two rival governments.
But German Foreign Minister Heiko Maas urged the EU to agree on a naval mission, saying aircraft monitoring would not be enough.
On Sunday, a senior UN official warned that the arms embargo was meaningless because there is no one to enforce it.
In a mainly symbolic move, Operation Sophia will now be scrapped. Mr Schallenberg said he agreed because the new mission was purely military, not humanitarian.
But under international law, EU ships are still required to rescue those in trouble on the high seas.
Mr Borrell said earlier on Monday that he did not expect a deal, because Vienna was still blocking.
On Sunday he said it was unacceptable that Austria, a country with no navy, could hold up an EU sea mission.
Mr Borrell had needed the backing of all 27 governments to proceed.
The EU will also consider a peacekeeping mission if a fragile truce becomes a ceasefire, diplomats said.