Hello

Me(I'm not from the EU) and my boyfriend(is spanish and has been living all his life in spain) decided to get married , However, I have a german resident permit which about to expire ,so it will be expired before the day we will get married in, and the thing is i can apply right now before it expires but i lost my passport and it takes 8 weeks to get a new one ,

so the question is ?can i get married to my spanish boyfriend even if Im gonna be illegaly(over stayed) in spain ?

Regards