Verses 1-13
Favouritism destroys love (2:1-13)
Standards of judgment in the church are not the same as those in the society round about. People ought not to be given important places in the church merely because they have important places in the society. Likewise poor people should not be ignored (2:1-4). God welcomes people into his kingdom regardless of wealth or social position, and gives his riches to them equally. James notes how strange it is that the Christians should show special favour to the rich, because the rich are from the class that oppresses Christians most cruelly (5-7).
In their dealings with others, the rule for Christians is 'Love your neighbour as yourself' (8). Those who show favouritism break that rule. They would, under Moses' law (where the rule was first taught; Leviticus 19:18), be considered law-breakers, no matter what other good they may have done. For example, they may not commit adultery, but if they kill they are still law-breakers (9-11).
Christians are not in bondage to the law of Moses, but God's 'law of liberty' within them should cause them to love others. If they show no mercy to the poor, God will show no mercy when he judges them. But if in mercy they refrain from harsh judgments, God will refrain from harsh judgment of them (12-13).
Verses 14-26
Proof of genuine faith (2:14-26)
The Christian faith is not merely a mental belief, but something that is practised. Those who say they have faith must give evidence of it by their behaviour. In the case of the poor Christians just referred to, it is useless to talk sympathetically to them but not give them food and clothing. A professed faith must produce a corresponding change in behaviour, otherwise it is dead and useless (14-17).
Genuine faith will prove itself by good deeds. The simple belief that God exists is not enough. Even demons have such a belief, but it will not help them escape God's judgment (18-19).
Abraham also had a belief in God, but it was a belief that completely changed his life and actions. True, Abraham was justified by faith when he whole-heartedly trusted God, even though he did not know how God could possibly fulfil his promise (Genesis 15:6; Romans 4:1-3; Romans 4:16-25). But that is not the incident James is talking about here. He is talking about the incident thirty years later, at the time of Abraham's offering of Isaac (20-21; cf. Genesis 22:1-18). Abraham not only said he believed in God, but he proved it by being willing to sacrifice Isaac on the altar. He believed that God could fulfil his promise of giving Abraham a multitude of descendants through Isaac, by bringing Isaac back to life (cf. Hebrews 11:17-19). Genuine faith is demonstrated not simply by the set of beliefs a person holds, but by the actions that those beliefs produce (22-24).
As with Abraham the friend of God, so with Rahab the prostitute, faith expressed itself in actions (25; cf. Joshua 2:1-21). Faith and good deeds are as inseparable as body and spirit (26).