Hi, Help wanted, and welcome to the forum.
You have put your finger on a theological conundrum that has perplexed the Christian Faith since the birth of Protestantism. Even so herculean a figure as Martin Luther experienced this perplexity, terming the Letter of James "A letter of straw" implying perhaps that those reading too much into it were asses.
However, over the years, many have gradually begun to see that there IS a continuance of thought between the writings of Paul and James, rather than a tension. Or rather, if there is a tension, then it is one of continuity, rather than contradiction.
There is no doubt that the fundamental precept of the NT is that faith is what operates in the believer, both saving, and justifying. But to quote a modern vernacular: Define faith.
Thats where both Paul and James work in tandem. Lets see if we can divine what both say:
1 Paul: The SOURCE of Justification is the unique quality of God called Grace. [Tit 3 :7] This grace provides the faith by which justification comes [Ro 3:30] - Example: Abraham [4:2,3]
2 James: But what KIND of faith justifies? One that is empty? No, but one that is evidenced by works. Yet it is not the works, but the faith, [which comes through God's grace] that justifies.[Ja 2:17,18] Example:Abraham
This is what Paul is saying: Abraham was justified by faith
James is saying that Abraham was justified by [faith that was evidenced by] works
Paul is talking of the PRIORITY of faith in justification, while James is extending this to show the PROOF of this justification. If I were to confess that I have been justified by faith, how would YOU [not God] know that I have been justified? By my works. You [not God] cannot see my heart, but the barometer to enable you to conclude the veracity of my statement is my works. God knew that Abraham had faith. But how could WE [not God] know that Abraham had this justifying faith? By his works.
We can be thankful that both, the letters of Paul and the letter of James were written, because it is only through the steroscopic sight from both points of view that the faith that justifies can be understood
Cheers