On the other hand, Paul also used Abraham as his example when he wrote this in Romans 4: "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 accounted to him for righteousness. Now to him who works, the wages are not counted as grace but as debt. But to him who does not work but believes on Him who justifies the ungodly, his faith is accounted for righteousness."
Look carefully (and honestly) at the significant difference in what was said ... and this is just one example out of many. Buying into the human ideology that declares everything written by men in the New Testament was dictated from the mouth of God will force people into coming up with all kinds of interpretations based on conjecture. Feeling the need to make it appear as though the apostles said the same thing leads to inconsistency about the gospel message. The NT pages explain to us where James was coming from in the early years after the cross when it came to the law and works ... and Jews and Gentiles. Therein lies the story of the bigger picture of the gospel which has brought the gift of God's righteousness, apart from works.