This is why “it was credited to him as righteousness.”
Abram believed the Lord, and he credited it to him as righteousness.
What does Scripture say? “Abraham believed God, and it was credited to him as righteousness.”
David says the same thing when he speaks of the blessedness of the one to whom God credits righteousness apart from works: