Rom. 4:2 For if Abraham were justified by works, he hath whereof to glory; but not before God.
5 But to him that worketh not, but believeth on him that justifieth the ungodly, his faith is counted for righteousness.
6 Even as David also describeth the blessedness of the man, unto whom God imputeth righteousness without works,
James 2:14 ¶ What doth it profit, my brethren, though a man say he hath faith, and have not works? can faith save him?
15 If a brother or sister be naked, and destitute of daily food,
16 And one of you say unto them, Depart in peace, be ye warmed and filled; notwithstanding ye give them not those things which are needful to the body; what doth it profit?
17 Even so faith, if it hath not works, is dead, being alone.
18 Yea, a man may say, Thou hast faith, and I have works: shew me thy faith without thy works, and I will shew thee my faith by my works.
Romans 4:2 does not forbid that justification by works gives room for boasting before men, but it does forbid boasting before God. The justification James speaks of gives room for boasting before men (James 2:18).
Romans 4:5-6 places works in contrast to faith and demands justification by faith is WITHOUT WORKS whereas James 2:17 denies that justification by faith is without works.
Paul allows for boasting about works before men but not before God whereas James is about boasting before men - James 2:15-16,18.
Paul says justification by faith is WITHOUT WORKS whereas James denies justification by faith is without works.
The solution is very simple. Paul is talking about justification before God and James is talking about justification before men. Before God only the works of Christ justify the sinner and therefore there can be no boasting as it is Christ's works not the sinners whereas before men only justification by works provides any PROFIT for his profession to be justified by faith.
James 2:14 ¶ What doth it profit, my brethren, though a man say he hath faith, and have not works? can faith save him?
15 If a brother or sister be naked, and destitute of daily food,
16 And one of you say unto them, Depart in peace, be ye warmed and filled; notwithstanding ye give them not those things which are needful to the body; what doth it profit?
17 Even so faith, if it hath not works, is dead, being alone.
18 Yea, a man may say, Thou hast faith, and I have works: shew me thy faith without thy works, and I will shew thee my faith by my works.