Paul asks what Abraham, our forefather according to the flesh, found. If he had been justified by works, he would have something to boast about, but not before God. Scripture says that Abraham believed God and it was counted to him as righteousness. To the one who works, wages are counted as a debt; to the one who does not work but believes in him who justifies the ungodly, his faith is counted as righteousness. David says the same when he speaks of the blessing of the person whom God does not count sin against and whose iniquities are forgiven.
Paul then asks whether this blessing is only for the circumcised. Abraham was declared righteous before he was circumcised, and circumcision came afterward as a sign and seal of the righteousness he already had by faith. So he is the father of believers who are uncircumcised and also of the circumcised who walk in the steps of his faith.
The promise that he would inherit the world did not come through the law but through the righteousness of faith. If heirs were those who rely on the law, faith would be empty, because the law brings wrath; where there is no law there is no transgression. So the promise depends on faith, in order that it may rest on grace and be guaranteed to all his offspring, those of the law and those of the faith of Abraham.
Finally Paul describes that faith: Abraham, nearly a hundred years old, hoped against hope that he would become the father of many nations, without weakening in faith when he considered his own body, as good as dead, and the barrenness of Sarah's womb, and he grew strong in faith, giving glory to God. That was counted to him as righteousness, and it was written for us also, who believe in him who raised Jesus from the dead, who was delivered up for our trespasses and raised for our justification.