Italian special forces boarded a cargo ship sailing from Turkey to France on Friday, after the crew were threatened by "pirates" off the Italian coast, the defence ministry said.
Marines dropped onto the vessel from helicopters after a number of "stowaways" used knives to threaten the crew, Defence Minister Guido Crosetto told reporters.
The ministry told AFP the aggressors appeared to be migrants, though their nationalities were unknown.
The ship was the Galata Seaways, a roll-on roll-off cargo ship -- designed to carry vehicles -- sailing under a Turkish flag with reportedly 22 crew members.
It set off from Topcular in Turkey on June 7 and was headed for Sete in southern France.
Some 15 stowaways had boarded the ship in Turkey, in the hope of reaching Europe, but were discovered by the crew, the Repubblica daily said.
"The migrants tried to take some of the crew hostage inside the bridge," ANSA news agency said.
The drama unfolded as the ship -- some 200 metres long and 20 metres wide -- was sailing in Italian waters, near the island of Ischia.
The captain managed to radio for help, sending an urgent request to Ankara, which then alerted the Italian authorities, according to reports.
After special forces stormed the ship, some of the stowaways were arrested but others "barricaded themselves in the depths of the hold," the Repubblica said.
"The ship is very big and it is not difficult to hide," minister Crosetto told a television show.
"When they heard the helicopter, (some of the stowaways) ran, then probably tried to escape by sea in the dark," he said.
"However, the ship is surrounded. We will see in the next few hours... who the pirates are and what they wanted to do," he said.
Italy's marines "had to take control of the ship, and they did so in a very short time," he said, adding that the crew was safe.
Coast guard and financial police boats were also involved in the operation, the Italian ministry said.
The cargo ship was escorted towards Naples and anchored just outside the port, where there was a heavy police presence, local media reported.