This is a summary statement of the principle of justification by faith in Christ. God does not wait for someone to become morally righteous before he declares him or her justified, that is, righteous in his sight. He justifies the ungodly -- while still ungodly -- by their trust in him. They are united by faith to the Righteous One, Jesus Christ, who covers them with his righteousness (Jer. 23:6; 33:16; 2 Cor. 5:21). This means we may come freely to the One offering himself freely to us. If we try to earn this gift, it is proof that we do not think we are as hopeless as we are, nor do we think he is as gracious as he is.
Two quotes from Martyn Lloyd-Jones are helpful here...
To make it quite practical I have a very simple test. After I have explained the way of Christ to somebody I say “Now, are you ready to say that you are a Christian?” And they hesitate. And then I say, “What’s the matter? Why are you hesitating?” And so often people say, “I don’t feel like I’m good enough yet. I don’t think I’m ready to say I’m a Christian now.” And at once I know that I have been wasting my breath. They are still thinking in terms of themselves. They have to do it. It sounds very modest to say, “Well, I don’t think I’m good enough,” but it’s a very denial of the faith. The very essence of the Christian faith is to say that He is good enough and I am in Him. As long as you go on thinking about yourself like that and saying, “I’m not good enough; Oh, I’m not good enough,” you are denying God – you are denying the gospel – you are denying the very essence of the faith and you will never be happy. You think you’re better at times and then again you will find you are not as good at other times than you thought you were. You will be up and down forever. How can I put it plainly? It doesn't matter if you have almost entered into the depths of hell. It does not matter if you are guilty of murder as well as every other vile sin. It does not matter from the standpoint of being justified before God at all. You are no more hopeless than the most moral and respectable person in the world.
~ Martyn Lloyd-Jones, Spiritual Depression.
"This is Christianity: not your little goodness and mine: not what I am doing and what I am not doing. Not how much better I am than somebody else; not how much better I am than I once was. No, you forget it all and look to Him. You see His perfect spotless righteousness and you know that if you believe in Him it is given to you and you are clothed with it."
~ Martyn Lloyd-Jones, The Kingdom of God.