Paul, Peter, and the other Jews, because of their familiarity with Scripture (the Old Testament), would have known that a man could not be justified in God's eyes through the "works of the law"—by his own righteousness (Psalm 130:3; 143:2; Exodus 34:7; Job 4:17; 9:2-3,29; 15:14; 25:4; Ecclesiastes 7:20).
It is impossible for us, once we have sinned even once, to be in alignment with God of our own volition. Justification is an act of God by which He declares a person acceptable before Him because Christ has borne the sinner's guilt. However, this is the beginning of the common misconception that faith and works are mutually exclusive. In that view, works are of no avail at all, and all one has to do is "believe." But that notion is refuted in Matthew 7:21-23 and James 2:19-20, among other places.
The common interpretation of this verse—that belief is all that is required—cannot be correct, for it is contradicted in James 2:21 and Romans 2:13. Given that Scripture cannot be broken (John 10:35), all three of these verses must complement rather than contradict each other. It should be remembered that in Galatians 2:6, 9, Paul met with the leaders in Jerusalem—including James—and there was no disagreement between them! Verse 6 shows that they did not have anything to "add" to what Paul was preaching to the Gentiles, and by extension, there was nothing to be taken away, changed, etc. Verse 9 shows they agreed on their respective responsibilities, but there is no indication of any doctrinal disagreement between them. In this light, it can be concluded that the verse in question here will not only agree with, but will also complement what James wrote, as well as what Paul wrote in Romans 2:13 (or else Paul would have been double-minded, and thus "unstable in all his ways"; James 1:8).
Was not Abraham our father justified by works when he offered Isaac his son on the altar? Do you see that faith was working together with his works, and by works faith was made perfect? And the Scripture was fulfilled which says, "Abraham believed God, and it was accounted to him for righteousness." And he was called the friend of God. You see then that a man is justified by works, and not by faith only. (James 2:21-24)
This section by James appears to contradict directly what Paul says in Galatians. If we go by the common interpretation, these verses are diametrically opposed to each other. Given that Scripture cannot be broken, however, these passages must complement one another. The interpretation of one or both of them is wrong when the conclusion is reached that one is justified by faith only.
The faith that is mentioned in either one of those verses is given without qualification as to when the faith is used—whether for justification or sanctification. The context of Galatians 2:16 seems to indicate it is talking about justification (being brought into alignment with God and His law after He has called us out of the world; John 6:44). However, in James 2:24 it is not clear whether he is referring to justification or sanctification, but it seems to be a little bit more weighted toward sanctification (the process one goes through after entering into the covenant with God).
James 2:20 shows plainly that faith without works is dead at any time during a Christian's calling and conversion—whether for justification or sanctification.
The picture begins to form that works indeed may play a part in a person's justification. To look at it another way: Does repentance play a part in God's forgiveness of our sins, and thus justification? Repentance is not merely feeling sorrow and crying out to God, as II Corinthians 7:1 shows (where we are commanded to cleanse ourselves). Repentance also includes a change of mind and heart, and at the very least, the beginning of turning to God in obedience. Repentance is not genuine if one is merely sorry; one has to begin to change his ways to show how deep the sorrow goes. All too often we are sorry that we are caught, or that we have to pay the consequences, rather than truly being sorry for sinning (falling short of the glory of God). True repentance will be a deep conviction that what we have done is wrong, and it will be deep enough to motivate us to change from our past behavior—and this change qualifies as "works." As it has been said, "God saves us from our sins, not in our sins." There is a difference, and this gives an indication that there may indeed be a measure of works involved in Galatians 2:16, small though it may be.
Galatians 2:16 does not say in the Greek exactly what it says in the English, and it sheds light on our understanding of the relationship between faith and works when we understand it as it is written in the Greek. The phrase in question here is: "A man is not justified by works of the law, but by the faith of Jesus Christ." In the Greek it says, "A man is not justified by the works of the law: [he is not justified] except through faith in Jesus Christ."
This is a very significant difference. "Except through" points to the means by which justification is accomplished without nullifying or canceling out the importance of works. The verse is not saying that works are of no avail or are unimportant. Clearly, they are important in the example of repentance. It is saying that works without faith in the blood of Jesus Christ are of no avail. Works, coupled with faith in Jesus Christ, are just fine. But all the works in the world, if they are not coupled with faith in Jesus Christ are of absolutely no avail!
This makes Galatians 2:16 agree perfectly with James 2:20-24: "Faith without works is dead." Living faith and works go together, in terms of either justification or sanctification, if the works are combined with faith in Jesus Christ. Faith and works are not contradictory, but complementary, IF Christ is part of the mix. Works of the law do not justify a man, except through faith in Jesus Christ.
Paul is saying that any amount of lawkeeping—it does not matter if it is Gnostic law, Judaic law, the statutes or judgments of God, the Ten Commandments—if it is not connected to faith in Jesus Christ, accomplishes nothing in terms of justification. Even keeping the Ten Commandments must be coupled with faith in Jesus Christ. Paul is not saying the law is done away; he is tying the two of them together, and it is a positive combination—if the faith in Jesus Christ is the main ingredient.
Galatians 2:16 makes even more sense when it is compared to Romans 2:13: "For not the hearers of the law are just before God, but the doers of the law shall be justified." The keeping of God's law alone will not justify them, but God expects that someone who has faith in Christ will keep His law, and therefore it is good to do that, because works are evidence in what one has faith. Without works, God would never be sure of what we really believe (see, for example, Genesis 22:11-12).