Marines dropped onto the vessel from helicopters after a number of “stowaways” used knives to threaten the crew, Italian 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 7 June 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 reported.
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,” 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.
“However, the ship is surrounded. We will see in the next few hours… who the pirates are and what they wanted to do.”
Italy’s marines “had to take control of the ship, and they did so in a very short time,” he said, adding the crew was safe.
The Italian ministry said coast guard and financial police boats were also involved in the operation.
The cargo ship was escorted towards Naples and anchored just outside the port, where there was a heavy police presence, local media reported.