Can a non eu citizen (american) marry a person (columbian) in the eu (spain) that is not legally residing there (been here 5 years with no papers)?

Thanks a lot for taking the time to answer this!