This passage has been used as a football, kicked back and fore between individuals who try and imagine that James is disagreeing with Paul about how a person is justified before God. They forget that James wrote this section to deal with an area of pastoral concern and not as a contribution to the local theological society.
With regard to what is said here about Abraham and Rahab, we can assume that Paul was aware of what James had written because this letter was one of the first of the New Testament letters to be composed. Paul may even have read it when it reached the synagogues in Damascus where many Christians from Jerusalem had fled after the persecution connected to the death of Stephen. Yet Paul made no attempt to have the letter of James removed from Christian circles; indeed, he spoke highly of James in his letters.
It is possible for some words to have different meanings depending on the context in which they are used. An obvious one is the word ‘salvation’. Does it mean rescue from a dangerous physical situation or does it mean deliverance from eternal punishment? Or the word ‘heaven’. Does it mean the atmosphere or the night sky or the dwelling place of God? The word ‘faith’ can refer to an intellectual response or to a heart response, to a false claim or to dependence on Jesus. The word ‘justify’ can mean ‘reckon righteous’ or ‘vindicate’.
The issue that James is concerned with here is genuine faith. Someone must have been teaching that works were unnecessary and that a faith without works was acceptable. Maybe they were misapplying what Paul had been teaching because he was involved in teaching in the church in Antioch at the time this letter was written. It is possible to have such a faith.
James points out that this is the kind of faith that the demons have, and it is not confined to them. After all, the devil has an accurate faith and in a certain sense his faith produces the right response for him, which is that he shudders at the prospect awaiting him. The obvious danger that James is dealing with is an orthodoxy without practice. We obviously object to a practice without orthodox beliefs, that is liberalism. But here James is countering orthodoxy without practice, which is a danger facing all evangelical churches.
James is not suggesting that a person with a false faith only has to add works to it in order to make it genuine. His point is that a genuine faith in Christ will produce certain works automatically. Adding external works to a false faith does not produce saving faith because it is an attempt to add an external activity whereas true biblical living flows from faith in God and is not an addition to it. The fact of the matter is that these verses are very serious and solemn because they call us to a reality check about the nature of our personal faith.