The Spanish coast guard posted a dramatic photo of the three men precariously perched atop the rudder of the Maltese-flagged Alithini II as it arrived in Las Palmas, Gran Canaria, on Monday.
Their feet are seen dangling just inches above the water behind the massive hull.
The ship — which left Lagos, Nigeria, on Nov. 17 — covered some 2,000 miles during the 11-day journey to the Spanish territory off northwest Africa, according to tracking website Marine Traffic.
They were treated for dehydration and hypothermia after their perilous trip, officials said.
Txema Santana, a migration adviser to the local government, said in a tweet: "It is not the first and it will not be the last. Stowaways do not always have the same luck."