What then shall we say was gained by Abraham, our forefather according to the flesh? For if Abraham was justified by works, he has something to boast about, but not before God. For what does the Scripture say? “Abraham believed God, and it was counted to him as righteousness.” Now to the one who works, his wages are not counted as a gift but as his due. And to the one who does not work but believes in him who justifies the ungodly, his faith is counted as righteousness, just as David also speaks of the blessing of the one to whom God counts righteousness apart from works:Romans 4:7-8 (ESV)
“Blessed are those whose lawless deeds are forgiven,
and whose sins are covered;
blessed is the man against whom the Lord will not count his sin.”
In Psalm 32 King David expresses the blessedness of forgiveness. David had committed sins of which the consequences of those sins still occurred, but he received forgiveness and a restored relationship with the Father when he cried out to God. Righteousness comes through faith to us as well. It is credited to us as a gift, apart from works.