The man almost lost his thumb to the fish, which experts believe was a type of blue shark known in Spain as a tintorera, when he was swimming off the Arenales del Sol beach in Elche on Friday.
Lifeguards saw him emerge from the waves with blood pouring from a wound in his hand.
He was immediately taken to hospital in Elche where he received several stitches before being discharged.
The beach was closed to swimmers for several hours while lifeguards attempted to find the shark, a variety that does not normally attack humans.
Experts said such attacks were “extremely rare”.
“Swimmers shouldn't be worried as people are not considered prey to this species. They will only bite in very rare circumstances,” a marine expert from CRAM told Atlas news.