How can you say that salvation is by faith alone when the Bible (James 2:24) says that salvation is not by faith alone?

This one verse in the Bible that contains the exact phrase “faith alone” seems to argue against salvation by faith alone. James 2:24 reads, “You see that a person is justified by works and not by faith alone” (ESV). However, rejecting the doctrine of salvation by faith alone based on this verse has two major problems. First, the context of James 2:24 is not arguing against the doctrine of salvation by faith alone. Second, the Bible does not need to contain the precise phrase “faith alone” in order to clearly teach salvation by faith alone.

The epistle was primarily written to Jews who had identified themselves with the Christian faith. Some of them obviously were genuine and some of them were less than genuine. But they had outwardly identified with the Christian faith. It is possible James was writing to Jews who had ditched the works righteousness of Judaism but, instead, had embraced the mistaken notion that since righteous works and obedience to God’s law were not efficacious for salvation, they were not necessary at all. Thus they reduced faith to a mere mental assent to the facts about Christ.

James’s point is not that a person is saved by works (he has already strongly and clearly asserted in ch.1:17–18 that salvation is a gracious gift from God), but that there is a kind of apparent faith that is dead and does not save (vv. 14, 17, 20, 24, 26). The truth that James emphasizes in this text and that the Word of God teaches throughout is that what we do reveals who we are. James is not speaking simply of beliefs and intentions in general but of the foundational belief of saving faith. The genuineness of a profession of Jesus Christ as Savior and Lord is evidenced more by what a person does than by what he claims. A person who professes Christ but who does not live a Christ-honoring, Christ-obeying life is a fraud.

FAITH + NOTHING = DEAD (DOOMED)

James is saying that there is absolutely no benefit having a faith without good deeds. In v17, he calls it “dead faith”. Also, in V26 he concludes the chapter by saying, “faith apart from works is dead. There is a kind of faith in God that does not save. There is a kind of faith in Jesus Christ that does not save. It is not the Sayers, it is the Doers. Faith apart from work is dead and that faith does not save.

Is James contradicting Paul?
James is NOT suggesting that doing good work is a prerequisite to salvation. There’s no salvation by works. In Romans chapter 3 Paul says in verse 20, “By the deeds of the law will no flesh be justified in His sight.” On the other hand, it says in verse 24, “Justified freely by His grace.” We are made right with God by His grace. He dispenses that grace to us. We respond in believing faith to that sovereign grace and we’re saved. No works involved.

Paul in Ephesians 2:8-9: “For by grace you have been saved through faith. And this is not your own doing; it is the gift of God, not a result of works, so that no one may boast.” Taking all the scriptures together, No one is saved by works — but no one is saved without producing righteous works as a result of true faith. V10: For we are his workmanship, created in Christ Jesus for good works, which God prepared beforehand, that we should walk in them.

Paul in Galatians 2:16: “yet we know that a person is not justified by works of the law but through faith in Jesus Christ, so we also have believed in Christ Jesus, in order to be justified by faith in Christ and not by works of the law, because by works of the law no one will be justified.”

Justified by works (V21 & 25) – The Greek verb dikaioo (justified) has two general meanings. The first pertains to acquittal, that is, to declaring and treating a person as righteous; that is its meaning in relation to salvation and is the sense in which Paul almost always uses the term. The second meaning of dikaioo pertains to vindication, or proof of righteousness; it is used in that sense a number of times in the New Testament, in relation to God as well as men. It is this second meaning that is in view in this passage.

This does not contradict Paul’s clear teaching that Abraham was justified before God by grace alone through faith alone. For several reasons, James cannot mean that Abraham was constituted righteous before God because of his own good works: (1) James already stressed that salvation is a gracious gift (1:17–18); (2) in the middle of this disputed passage (v. 23), James quoted Genesis 15:6, which forcefully claims that God credited righteousness to Abraham solely on the basis of his faith; and (3) the work that James said justified Abraham was his offering up of Isaac, an event that occurred many years after he first exercised faith and was declared righteous before God. Instead, Abraham’s offering of Isaac demonstrated the genuineness of his faith and the reality of his justification before God. James is emphasizing the vindication before others of a man’s claim to salvation. His teaching perfectly complements Paul’s writings; salvation is determined by faith alone (Eph. 2:8–9) and demonstrated by faithfulness to obey God’s will alone (Eph. 2:10).

James is not at odds with Paul. “They are not antagonists facing each other with crossed swords; they stand back to back, confronting different foes of the gospel” [Alexander Ross, “The Epistle of James and John”]. James and Paul both echo Jesus’ preaching. Paul’s emphasis is an echo of Matthew 5:3: “Blessed are the poor in spirit, for theirs is the kingdom of heaven.” James’s teaching has the ring of Matthew 7:21: “Not everyone who says to Me, ‘Lord, Lord,’ will enter the kingdom of heaven; but he who does the will of My Father who is in heaven.” Paul represents the beginning of the Sermon on the Mount; James the end of it. Paul declares that we are saved by faith without the deeds of the law. James declares that we are saved by faith, which shows itself in works. Both James and Paul view good works as the proof of faith—not the path to salvation.

reference:
John McArthur – What Role Do Works Have In Salvation?
The Gospel According to the Apostles, by John MacArthur.
John Piper – Does James Contradict Paul?