Help identifying organism
It is definitely a crab - not anything spider. I originally thought it was a Sally Lightfoot Crab (a common crab on Madeira from the family of shore crabs) but I agree on your comment that it is more likely a Nimble Spray Crab (of the Flat Crab genus) as the specimen in your photo seemed a lot flatter than a shore crab (but I wasn't sure if it was just the shape of the rock).
The Wikipedia article on this species says that these are also referred to as another kind of Sally Lightfoot crab, and the fact that these are in a different taxonomic family from the other ones (the shore crabs) is a topic of debate.

They are observed in the coastal Atlantic and considered native to Madeira, but have recently spread into the Mediterranean

You can view a gallery of almost 200 photos of these crabs on iNaturalist.