Can an illegal immigrant get resident permit through marrage to a non EU resident with resident permit (NIE) of long duration (5 year).
You can marry a non EU legal resident even while being in an irregular situation as , generally speaking, the authorities will not require that you hold legal residency to get married, but at least hold a valid passport. However, you will have to travel back to your home country after getting married as you can only enter the country with a valid visa in order to obtain the family reunion residency once your partner has applied for the family regrouping residence card for you and this has been approved.
There is another option to obtain residency after getting married to a legal resident, that is by Arraigo social ( residency settlement ), in the event that you have already lived in Spain during 3 years and have secured a 1 year work contract.
Please feel free to contact me on Patricia at Lawbird.com if you wish to get more detailed information.