In Romans 4 Paul uses Abraham as an example of one who was counted as righteous. It was imputed to him or credited to him. Paul emphasizes that it was not by works, but by faith that Abraham was justified. One must understand that “works” as Paul used it there means works without faith, works of the law, works that would deserve a reward. In order for a person to be saved by works in this sense, he would have to keep every command of God perfectly. This is why no one is justified by the law. Abraham had sinned therefore, justification could only be by grace and not by the law of works. (Romans 6:14)
Today, you and I are justified, counted righteous when we by faith do what God has commanded. Faith is essential but it must be accompanied by obedience. When it is, God imputes righteousness to our account. Has your spiritual record been credited with righteousness?