It was not through the law that Abraham and his offspring received the promise that he would be heir of the world, but through the righteousness that comes by faith. For if those who depend on the law are heirs, faith means nothing and the promise is worthless, because the law brings wrath. And where there is no law there is no transgression. Romans 4:13-15 NIV
If righteousness were to be the result of the obedience to the law, then, as Paul states here, faith is meaningless. But what comes from the law, the law of God is wrath, as mankind is of sinful nature, and sin brings upon the guilty one the wrath of God. But, through faith, faith in Jesus Christ, the repentant sinner is forgiven and deemed to be righteous in the eyes of God.
Righteousness comes only through faith and not through works. Do works in obedience to the Lord, yet realize that you cannot win your salvation, nor righteousness except through faith in Jesus Christ. He is the only way to the Heavenly Father.