(Rom 4:1) What shall we say then that Abraham our father, as pertaining to the flesh, hath found?
(Rom 4:2) For if Abraham were justified by works, he hath whereof to glory; but not before God.
(Rom 4:6) Even as David also describeth the blessedness of the man, unto whom God imputeth righteousness without works,
(Rom 4:7) Saying, Blessed are they whose iniquities are forgiven, and whose sins are covered.
this supposedly contradicts James-
Jas 2:21 Was not Abraham our father justified by works, when he had offered Isaac his son upon the altar?
Jas 2:25 Likewise also was not Rahab the harlot justified by works, when she had received the messengers, and had sent them out another way?
But the thing is.. the context of James.. mostly isn't about receiving eternal life.. where in Romans it is about receiving eternal life.
James also has:
Jas 5:15 And the prayer of faith shall save the sick, and the Lord shall raise him up; and if he have committed sins, they shall be forgiven him.
Jas 4:6 But he giveth more grace. Wherefore he saith, God resisteth the proud, but giveth grace unto the humble.
which agrees with Romans
also
Pretty much all of James is about acts of service.. christian testimony.. our daily work. In Romans - like Romans chapter 10.. you see the call for salvation.. entrusting your salvation with Jesus. They don't contradict.. they are different contexts and subjects.
The reason James was included in the canon is because they knew by context it did not disagree with Paul's writings.