The European Union's highest court has backed the right of companies to move to another EU state to cut costs.
The Rosella was given an Estonian flag and took on an Estonian crew
The European Court of Justice (ECJ) was ruling on a Finnish ferry company, Viking, which replaced the crew on one of its ships with Estonian workers.
Trade unions intervened, preventing Estonian union members from negotiating with the company.
The court said unions were allowed to take collective action, if jobs and work conditions were under threat.
The ECJ decided it was up to the national court to decide whether jobs were likely to be affected.
But it warned the unions that collective action would be illegal if it restricted the EU's freedom of establishment, which guarantees a company's right to carry out economic activity in other member states.
The ruling is being seen by unions as a test-case on what has become known as social dumping, the transfer of jobs from Western countries to other EU countries in Central and Eastern Europe.
The ferry involved, the Rosella, had been running at a loss with a relatively well-paid Finnish crew in the run-up to Estonia joining the EU in 2004.
A spokesman for the International Transport Workers Federation said the court's ruling was not ideal, but it was glad to see the fundamental right to strike upheld.
The ECJ will rule next week on a similar case in which unions in Sweden prevented a Latvian construction firm from fulfilling a contract in Sweden because it offered Latvian pay and conditions.