Now we know that whatever the law says, it says to those who are under the law, so that every mouth may be silenced and the whole world held accountable to God. Therefore no one will be declared righteous in his sight by observing the law; rather, through the law we become conscious of sin. But now a righteousness from God, apart from law, has been made known, to which the Law and the Prophets testify. This righteousness from God comes through faith in Jesus Christ to all who believe. There is no difference, for all have sinned and fall short of the glory of God, and are justified freely by his grace through the redemption that came by Christ Jesus. God presented him as a sacrifice of atonement, through faith in his blood. He did this to demonstrate his justice, because in his forbearance he had left the sins committed beforehand unpunished he did it to demonstrate his justice at the present time, so as to be just and the one who justifies those who have faith in Jesus. Where, then, is boasting? It is excluded. On what principle? On that of observing the law? No, but on that of faith. For we maintain that a man is justified by faith apart from observing the law.
Once a person has sinned, they are under the penalty of the law, and their righteousness is not sufficient to justify them before God. Since all have sinned, the whole world is guilty before God. It takes a righteousness apart from law keeping to do this.
Then Paul says that this righteousness is revealed in the Old Testament Law and Prophets! The teaching has been there all along, all through the centuries from Moses to Christ and down to our time! God never changed His course. In the first century, He only openly revealed the means, Christ, through whom would come the righteousness that will justify one before God.
Men have always been justified and saved by grace through faith. People who were saved during Old Testament times looked forward in faith to this being accomplished. We look backward at it as a promise and as fulfilled prophecy. So Justification is not something that one earns by any kind of law keeping or good works, but God freely gives it to those who repent - turn from their sinful ways - and have faith His Son's sacrifice.
Paul the Apostle further drives home the point that no one can earn justification or boast about having received it through his own effort. "Where is boasting then? It is excluded. By what law? Of works? No, but by the law of faith."
No one can ever brag about having been so obedient or having done so many good works that God just had to grant him eternal life. No one will ever be able to boast that he "earned" his way into the Kingdom of God! All those who enter the Kingdom will have done so solely because God extended His mercy to them and forgave their sins through their faith in the sacrifice of Christ.