Defence ministers Lindiwe Sisulu of South Africa and Filipe Nyusi of Mozambique signed the agreement in Pretoria.
They would not take questions about why it had taken so long to formalise a deal to protect Mozambique’s 2470km coastline from Somali pirates whose range has increased tenfold in recent years.
They attacked a ship off Mozambique last December.
What touches Mozambique touches South Africa, Sisulu declared.
She sent a South African ship into her eastern neighbour’s waters two months ago.
The Mozambique channel carries 30 per cent of the world’s oil and 98 per cent of South Africa’s maritime traffic.
South African Secretary of Defence Mpumi Mpofu says piracy is costing eight billion euros a year.
Various navies are spending 1.4 billion euros a year patrolling off the Somali coast where there were at least 200 attacks and 68 successful hijackings last year.
Prosecuting pirates costs 21 million euros a year and 104 million euros is spent paying ransoms.
The Mozambique and South African navies will share patrols, training and information.