Welcome to the Wefugees community and thank you for your question.
Nelly already gave a good answer. Let me just add that you should get in contact with the registry office in your city to learn more about the procedure. They will be able to tell you about the required documents etc.
Keep in mind that at least one of the spouses needs to be registered in Spain in order to be allowed to marry there.