There is no contradiction between Paul and James. It is through faith "in Christ alone" (and not by the merits of our works) that we are justified on account of Christ (Romans 3:24; 5:1; 5:9); yet the faith that justifies is never alone (solitary, unfruitful, barren) if it is genuine (James 2:14-24). *Perfect Harmony*
James is not using the word "justified" to mean "accounted as righteous" but is "shown to be righteous." James is discussing the
evidence of faith (
says-claims to have faith but has no works/I will show you my faith by my works - James 2:14-18),
not the initial act of being accounted as righteous with God (Romans 4:2-3).
In James 2:15-16, the example of a "work" that James gives is: "If a brother or sister is naked and destitute of daily food, and one of you says to them, "Depart in peace, be warmed and filled," but you do not give them the things which are needed for the body, what does it profit?" To give a brother or sister these things needed for the body would certainly be a "good work" yet to neglect such a brother or sister and not give them the things needed for the body is to
break the second great commandment "love your neighbor as yourself" (Matthew 22:39)
as found written in the law of Moses (Leviticus 19:18).
In Matthew 22:37-40, we read: Jesus said to him, 'You shall love the Lord your God with all your heart, with all your soul, and with all your mind.' This is the first and great commandment. And the second is like it: 'You shall love your neighbor as yourself.'
On these two commandments hang all the Law and the Prophets. We cannot dissect good works from these two great commandments which are found in the law of Moses. (Deuteronomy 6:5; Leviticus 19:18) So the not saved by "these" works (works of the law) but saved by "those" works (good works) argument is bogus.