"But Israel, which followed after the law of righteousness, hath not attained the law of righteousness. Wherefore? Because they sought it not by faith, but as it were by the works of the law. For they stumbled at the stumblingstone; As it is written, Behold, I lay in Sion a stumblingstone and rock of offence: and whosoever believeth on Him shall not be ashamed." Romans 9:31-33
It's simple. Righteousness is imputed into us by God. This righteousness that is imputed cannot be earned, cannot be attained, does not come with a second blessing, is not because we possess or operate in one of the gifts of the Spirit or because we have a church membership or that we have worked real hard. The righteousness that is imputed into you is given to you by God because you have faith in Jesus.
This is a real issue with those who have not accepted Jesus as the only propitiation for our inherent sin. Those who have not accepted the grace of God through faith are those who stumble at the stumblingstone. Not everyone believes that Jesus is the only way to God. Those that don't believe that Jesus is the only way to God are trying all kinds of ways to get to God. Religion, works, legalism, philosophy, intellectual acumen, does not constitute faith. Raw faith in (Jesus plus nothing) does constitute the righteousness of God. Having said all that, the righteousness of God is given to believers in Jesus because God set it up this way. To try and find some other way to God is futile.