For what saith the scripture? Abraham believed God, and it was counted unto him for righteousness.
Romans 4:3 (KJV)
We are righteous in the sight of God not because of our works, but as a result of us believing Him. Faith in the finished works of Jesus is what declares us one hundred percent righteous. And it is out of us believing that we are the righteousness of God in Christ Jesus that our good works will then flow.