In Romans 4:5, it is written that
to him that worketh not, but believeth on him that justifieth the ungodly, his faith is counted to him for righteousness.
Therefore the Lord justifies the ungodly person.
However, He does not leave them in that state; for justification is to declare righteous. And it is impossible for God to lie. He calls those things which be not as though they are (Romans 4:17); and in so doing creates a new reality; that the person is righteous in reality and in the practical sense (Matthew 5:6, Romans 5:19, 1 John 3:7).
In imputing righteousness to a man, impartation cannot be far behind.
Yet, I would say that there is a valid teaching that we can glean from Romans 4:5, that God declares us righteous even when we blow it; and that therefore He calls us righteous in a sense that cannot be shaken. If you believe in Jesus, then the Lord counts you as righteous no matter whether you sin or not. Your identity in Christ is that you are the righteousness of the Lord in Him (2 Corinthians 5:21); and this identity is secure and cannot be messed with.
So then, because you
are righteous, go and live like it. Your behaviour ought to reflect who God says you are in Him.
It may not happen overnight; but because you are now righteous in Christ, you will begin to live righteously over the fact that your paradigm has shifted and because you have a new identity. You will behave like you believe yourself to truly be in every aspect of your faith.
And obedience is not a condition for salvation; while it is the normal result of being truly saved. If I believe in Christ with a saving faith and die two minutes later, I had no opportunity to do any good works. Do I then go to hell? If obedience is a condition then I do.
However, I don't believe that the Bible teaches us that:
Rom 4:5, But to him that worketh not, but believeth on him that justifieth the ungodly, his faith is counted for righteousness.
Rom 4:6, Even as David also describeth the blessedness of the man, unto whom God imputeth righteousness without works,
Because I do believe that works translates into obedience; and therefore it is saying here that to him that obeyeth not, but believeth on him that justifieth the ungodly, his faith is counted for righteousness. And that God counts righteousness to those who are not obedient.
So then, does this mean that we ought to just sin and not be obedient to the Lord? God forbid! We who have died to sin ought not to live in it any longer.
Everyone is a sinner before they come to faith in Christ.
Therefore, the Lord has to justify sinners or else no one would be justified.
He does not leave them in the state of being sinners (2 Corinthians 5:17).
But the verses in question show that our salvation is not dependent upon our obedience but on a simple faith in what Christ did for us on the Cross.
If anyone receives this and is thankful, they will love Jesus much (Luke 7:36-50, 1 John 4:19, Romans 5:5). And this will result in practical obedience (1 John 3:17-18).
We must not put the cart before the horse. Salvation is through simple faith (alone) in the finished work of Christ upon the Cross; and obedience is the sure result of salvation for those who are not of the same example as the thief on the Cross.