James 2 is the main battleground of the faith vs. works view of salvation. Is it really by grace we are saved, through faith, and that not of ourselves; it is the gift of God, not of works, lest anyone should boast? Ephesians 2:8-9 certainly says so. In fact, I copied and pasted that verse word for word, altering it only enough to put it in the form of a question, rather than the statement it actually is (please open your Bible and read the original). But some challenge this view. Using James 2, they argue that while salvation is by grace through faith, it is still of works.
There are two main ways this is done. The first is to point out that it repeatedly says "faith without works is dead", even asking "What does it profit, my brethren, if someone says he has faith but does not have works? Can faith save him?" (v14). The second is that verse 24 says "You see then that a man is justified by works, and not by faith only."
To a person who reads James, and only James, this will seem extremely clear cut. Salvation is by works, not faith alone. However, the good thing about the Bible is that it consists of 66 books, not just James 2.
One of those books is Genesis, to which James actually refers. Let's first read from James 2:20-24: "But do you want to know, O foolish man, that faith without works is dead? 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."
So, we see that James is using Abraham as his example, specifically referring to Abraham's belief in God, which was credited to him as righteousness, and his offering of Isaac, which is what justified him. So, go with me to Genesis 15. Specifically, verse 6: "And he believed in the Lord, and He accounted it to him for righteousness." So, this is the scripture that James says was fulfilled by Abraham's offering of Isaac. Now let's read the previous 5 verses:
"After these things the word of the Lord came to Abram in a vision, saying, “Do not be afraid, Abram. I am your shield, your exceedingly great reward.” But Abram said, “Lord God, what will You give me, seeing I go childless, and the heir of my house is Eliezer of Damascus?” Then Abram said, “Look, You have given me no offspring; indeed one born in my house is my heir!” And behold, the word of the Lord came to him, saying, “This one shall not be your heir, but one who will come from your own body shall be your heir.” Then He brought him outside and said, “Look now toward heaven, and count the stars if you are able to number them.” And He said to him, “So shall your descendants be.”"
And so we see that Isaac had not even been born yet. Rather, it was believing in Isaac's birth, and the fact that through Isaac, Abraham would have many descendants, that was credited to Abraham for righteousness. It is not until Genesis 22 that Abraham actually offers Isaac. But the offering was not completed, because God stepped in at the last moment, saying "Do not lay your hand on the lad, or do anything to him; for now I know that you fear God, since you have not withheld your son, your only son, from Me." (v12).
It is this that allows us to understand what it means when James says "faith without works is dead". It is not "faith without works cannot save", but rather "if you have the faith that saves, you will work". Note that God actually already knew Abraham's faith was genuine. It was credited to him as righteousness long before he had the chance to offer up Isaac. But by offering Isaac, he proved his faith, whereas if he did not actually have this faith, he wouldn't have taken Isaac to be burned.
But wait, doesn't James block this interpretation by saying "can faith save" the one who says he has faith, but does not have works? Not at all. It is worth noting first that although I have used the NKJV, which simply says "can faith save him?" (as does the KJV), most translations render it "can that faith save him?", "can such faith save him", or "can his faith save him?" Even the NABRE, a widely used Catholic translation, says "can that faith save him?" The implication, as James himself shows in this very chapter, is that there are different kinds of faith. It's not enough to just believe in God, because even demons do that (James 2:19). They show their faith by trembling.
Ray Comfort has an excellent analogy: A parachute. If you believe a parachute can save you from a crashing plane, that's all well and good, but you've got to put it on to receive its saving power. Similarly, it's all well and good believing in Jesus, but He can't save you if you don't put Him on. See, your actions stem directly from your faith. This is why James says "show me your faith without your works, and I will show you my faith by my works." (v18). It's not about getting saved, but proving that you are saved. This is further proven by the fact James says "a man is justified by works", not "a man is saved by works".
To illustrate the distinction, consider Luke 7:29. Here, we read "And when all the people heard Him, even the tax collectors justified God, having been baptized with the baptism of John." Now, does God need to be saved? Of course not! Saved from what? Who can God sin against? And who could judge Him for sinning against them? Certainly not a lowly tax collector! Imagine that. God somehow dies, His spirit is transferred to a spiritual courtroom, and there he finds tax collectors deciding if He gets to go to Heaven, or is condemned by Hell.
Luke continues. In Luke 7:35, we find that wisdom is "justified by her children". Wisdom is not even a conscious entity! Yes, the Bible typically personifies wisdom as a mother and a sister, but in reality, wisdom is not a person. Wisdom cannot sin, nor can it be forgiven for sin.
Thus, we see that there is a massive distinction between justification and salvation. Faith is by far enough for salvation, but nowhere near enough for justification. It is necessary to prove our faith, if for no other reason than to just have an onlooker understand it.
Thus, James is not contradicting the rest of scripture by teaching that good works are required for salvation. Rather, he teaches that works are indicative of the faith behind them. If you truly believe that you are a citizen of Heaven (Philippians 3:20), would you not act like it? Of course! And so faith without works is dead because living faith produces works.