But now the righteousness of God has been manifested apart from the law, although the Law and the Prophets bear witness to it—the righteousness of God through faith in Jesus Christ for all who believe. For there is no distinction: for all have sinned and fall short of the glory of God, and are justified by his grace as a gift, through the redemption that is in Christ Jesus, whom God put forward as a propitiation by his blood, to be received by faith. This was to show God's righteousness, because in his divine forbearance he had passed over former sins. It was to show his righteousness at the present time, so that he might be just and the justifier of the one who has faith in Jesus.Whereas James writes
Then what becomes of our boasting? It is excluded. By what kind of law? By a law of works? No, but by the law of faith. For we hold that one is justified by faith apart from works of the law. Or is God the God of Jews only? Is he not the God of Gentiles also? Yes, of Gentiles also, since God is one—who will justify the circumcised by faith and the uncircumcised through faith. Do we then overthrow the law by this faith? By no means! On the contrary, we uphold the law.
What then shall we say was gained by Abraham, our forefather according to the flesh? For if Abraham was justified by works, he has something to boast about, but not before God. For what does the Scripture say? “Abraham believed God, and it was counted to him as righteousness.” Now to the one who works, his wages are not counted as a gift but as his due. And to the one who does not work but believes in him who justifies the ungodly, his faith is counted as righteousness, just as David also speaks of the blessing of the one to whom God counts righteousness apart from works:
“Blessed are those whose lawless deeds are forgiven,
and whose sins are covered;
blessed is the man against whom the Lord will not count his sin.” (Rom 3:21-4:8)
What good is it, my brothers, if someone says he has faith but does not have works? Can that faith save him? If a brother or sister is poorly clothed and lacking in daily food, and one of you says to them, “Go in peace, be warmed and filled,” without giving them the things needed for the body, what good is that? So also faith by itself, if it does not have works, is dead.What should be noted is firstly, Paul is talking about works of the Mosaic Law, not doing works in general. Secondly, James is contrasting faith with faith; Paul is contrasting faith with works.
But someone will say, “You have faith and I have works.” Show me your faith apart from your works, and I will show you my faith by my works. You believe that God is one; you do well. Even the demons believe—and shudder! Do you want to be shown, you foolish person, that faith apart from works is useless? Was not Abraham our father justified by works when he offered up his son Isaac on the altar? You see that faith was active along with his works, and faith was completed by his works; and the Scripture was fulfilled that says, “Abraham believed God, and it was counted to him as righteousness”—and he was called a friend of God. You see that a person is justified by works and not by faith alone. And in the same way was not also Rahab the prostitute justified by works when she received the messengers and sent them out by another way? For as the body apart from the spirit is dead, so also faith apart from works is dead. (Jam 2:14-26)
James is declaring the type of faith that justifies. Faith justifies. But one cannot just say he has faith, i.e. he believes such and such. The demons believe certain things and are not justified. We have faith by trusting. Trusting is proved in obedience. Anyone who does not obey does not trust. So faith isn't a word that means "believe" or "trust", rather it carries actual trust. Faith is more orbed than what those who were challenging James were claiming. James is saying that when we are talking about justifying faith, faith means something that both believes certain things and acts on those beliefs.
Paul is not addressing this aspect when he talks about faith. Paul is discussing the issue of earning one's salvation. Paul is not contrasting faith with faith a la James, Paul is contrasting faith with works; and in a way that addresses the aspect of working (obeying the Mosaic Law) as a way of earning salvation.
So the Jew who is obeying the Law as a way to get into heaven is told this will not get you into heaven. You don't get into heaven by doing what God commands because you will fail. You can't earn your way there, you must have faith in God.
But the man who knows that faith and not works is the way of salvation may be tempted to rest in just believing God exists. He needs to know that faith in God for salvation is deeper than just acknowledging his existence.
So if you are trying to earn your way to heaven you need to know that you can't. You must have faith. If you think that this faith is merely an intellectual assent that God exists and that Jesus rose from the dead then you need to know that it is not, faith is active.