"What then shall we say that Abraham, our forefather, discovered in this matter?" NIV translation
In chapter 3, Paul showed us that our relationship with God is based on faith and that is the only way that we are declared not guilty of our sins (justified). Now, he looks to the Old Testament and the father of the faith which is Abraham.
Romans 4:2 & 3
"If, in fact, Abraham was justified by works, he had something to boast about - but not before God. What does the scripture say? 'Abraham believed God, and it was credited to him as righteousness.'" NIV translation
Here, Paul quotes from Genesis 15:6 which is the story of God's covenant (promise) to make his offspring as numerous as the stars in the sky. He was declared righteous because of his belief (faith). As an old man, Abraham was told to demonstrate his faith by offering his only son as a sacrifice. By faith in God, he went to obey but God stopped him from actually doing it. Not many of us would be willing to give up our only child as he was but, by faith, he went to obey. He was already justified by his faith before he even took one step to sacrifice his son.
Romans 4:4 & 5
"Now when a man works, his wages are not credited to him as a gift, but as an obligation. However, to the man who does not work but trusts God who justifies the wicked, his faith is credited as righteousness." NIV translation
Righteousness comes by faith and not from works as we see here. Even Abraham who was willing to give up his only son (which is a beautiful picture of what God was going to do for all of us) did not earn his right relationship with God. By faith, he believed that God would provide another son to keep His promise and, even though he did not have to really give up his son, God provided His own Son to be our perfect sacrifice.
"David says the same thing when he speaks of the blessedness of the man to whom God credits righteousness apart from works: 'Blessed are they whose transgressions are forgiven, whose sins are covered. Blessed is the man whose sin the Lord will never count against him.'" NIV translation
Paul gives us another example from the Old Testament by quoting King David and Psalm 32. We see in this that David understood that we are not justified by works as he speaks of forgiveness. Forgiveness is a gift that is given from the one who was offended to the one who committed the offense.
Romans 4:9 & 10
"Is this blessedness only for the circumcised, or also for the uncircumcised? We have been saying that Abraham's faith was credited to him as righteousness. Under what circumstances was it credited? Was it after he was circumcised, or before? It was not after, but before!" NIV translation
We see, from this example, that the physical does not determine righteousness. The blessedness that Paul is talking about is the forgiveness of sins and it is for all who will accept it in faith.
"And he received the sign of circumcision, a seal of the righteousness that he had by faith while he was still uncircumcised. So then, he is the father of all who believe but have not been circumcised, in order that righteousness might be credited to them." NIV translation
Abraham is a picture of the coming of Christ in that, by faith, we are all brought into the family of God. Abraham received a seal (circumcision) so that others would know that he was a child of God. We, too, receive a seal when we accept Jesus by faith but our seal is the Holy Spirit.
"And he is also the father of the circumcised who not only are circumcised but who also walk in the footsteps of the faith that our father Abraham had before he was circumcised." NIV translation
Jews also are children of Abraham and justified by that same faith. Though they are circumcised, we see here that it is still their walk by faith that makes them Abraham's children and justified before God.
"It was not through the law that Abraham and his offspring received the promise that he would be heir of the world, but through the righteousness that comes by faith. For if those who live by law are heirs, faith has no value and the promise is worthless, because law brings wrath. And where there is no law there is no transgression." NIV translation
This passage makes it clear that it is only by faith that we are saved. It also gives us a clear understanding of the purpose of the law. The purpose of the law is to make us aware of our inability to live up to God's standard. Because of this inability to do so on our own, we can see the need for a savior that could do it on our behalf. You cannot add anything to faith for salvation because, if you do, it is no longer by faith. This is the same thing that Paul said in Ephesians 2:8 & 9.
"Therefore, the promise comes by faith, so that it may be by grace and may be guaranteed to all Abraham's offspring - not only to those who are of the law but also to those who are of the faith of Abraham. He is the father of us all." NIV translation
We are one with God's people (Israel) because of this promise. Both Jews and Gentiles share the promise by faith.
"As it is written: 'I have made you a father of many nations.' He is our father in the sight of God, in whom he believed - the God who gives life to the dead and calls things that are not as though they were." NIV translation
This verse speaks about the promise that God made to Abraham. It also reminds us that God is the creator of all things as they are created simply by His words.
"Against all hope, Abraham in hope believed and so became the father of many nations, just as it had been said to him, 'So shall your offspring be.'" NIV translation
With God there is always hope as we see with the example of Abraham. We also see that, when God promises something, He keeps his word. If we trust and believe, we can confidently wait for His perfect timing.
"Without weakening in his faith, he faced the fact that his body was as good as dead - since he was about a hundred years old - and that Sarah's womb was also dead. Yet he did not waver through unbelief regarding the promise of God, but was strengthened in his faith and gave glory to God, being fully persuaded that God had power to do what he had promised." NIV translation
Faith as demonstrated by Abraham is belief in God's promises even when it does not make sense to us. Abraham and Sarah were too old to have a child in earthly terms but with God all things are possible. We too can simply trust God or we can "waver through unbelief" but that does not please God as we see in Revelation 3:15.
"This is why 'it was credited to him as righteousness.'" NIV translation
There is a big difference between wages and credit in accounting. Wages are payments that are received based on your physical efforts while a credit to your account does not require your own efforts. Abraham simply believed God and so it did not require any work on his part. Therefore, his righteousness was credited to him as a gift.
"The words 'it was credited to him' were written not for him alone, but also for us, to whom God will credit righteousness - for us who believe in him who raised Jesus our Lord from the dead. He was delivered over to death for our sins and was raised to life for our justification" NIV translation
If we believe that Jesus died for our sins and was raised from the dead by God, we will have righteousness with God. Justification is where the one that has the right and authority to make a decision about guilt declares that the accused is not guilty. It is like being charged for a crime, going to court, and being found not guilty.