Theoretically, there is nothing to stop you from getting married on the beach in Spain. The important thing is that you apply for the necessary papers in good time. Some hotels or event agencies even specialize in beach weddings.