Two dead stowaways were found on Monday in the cargo hold of a ship, which docked in the northwestern port of La Coruna on a voyage from west Africa, the local port authority said.
The Panamanian-flag ship, carrying 4,000 tons of cotton seeds, arrived on Sunday night from the West African country Togo after a stopover in neighboring Benin.
"The bodies were not crew and one would suppose they were stowaways from sub-Saharan Africa," said a spokesman for the port authority.
Spain is considered the gateway to Europe for many Africans, who often brave the Straits of Gibraltar, the rough waters separating Spain and Morocco, in their efforts to enter Spain illegally.
Official figures show that nearly 15,000 Africans tried to enter Spain last year, and many others drowned in the attempt.