Some have argued that James contradicts Paul at this point, since James emphasized that both Abraham and Rahab, among others, were justified by works (James 2:21, 25). In fact, this seeming conflict between Paul and James has often been cited as one of the "contradictions" of the Bible.
There is no contradiction, however. Neither Abraham nor Rahab could have been justified by the "works of the law," and James never said they were. Abraham lived before God even gave the law to Moses, and Rahab lived in a pagan culture which knew nothing about it. Furthermore, James himself knew that no one could really be saved by the law, for he said that "whosoever shall keep the whole law, and yet offend in one point, he is guilty of all" (James 2:10).
Actually, both Abraham and Rahab were "justified"--which means "seen as righteous"--by faith in God and His provision of salvation (note James 2:23; Hebrews 11:31). The righteousness of Christ, who did keep perfectly the law of God, is imputed to believers by faith (Romans 4:3-5). God sees him or her as "in Christ," and so they are justified (recognized as righteous) solely through faith.
However, other men cannot see our faith, and therefore we must be justified in the sight of men by our works. True saving faith inevitably will manifest itself in works of righteousness. "For by grace are ye saved through faith; and that not of yourselves: it is the gift of God: . . . For we are his workmanship, created in Christ Jesus unto good works, which God hath before ordained that we should walk in them" (Ephesians 2:8, 10). HMM