Paul takes up this point in Romans 4. He begins not by stating that Abraham was not justified by the boastful kind of works, but rather that the reason Abraham did not boast was because he did not work at all, but believed on him who justifies the ungodly.
For if Abraham was justified by works, he has something to boast about, but not be-fore God. For what does the Scripture say? "Abraham believed God, and it was counted to him as righteousness." Now to the one who works, his wages are not counted as a gift but as his due. And to the one who does not work but believes in him who justifies the ungodly, his faith is counted as righteousness (vv. 2-5).
Clearly Abraham is not justified by works according to Paul, meaning that whatever James is talking about when he says that the patriarch was justified by works, it must be something different than what Paul is referring to.
Moreover, the apostle makes it clear elsewhere that the fact that salvation is by grace demands that it be by faith, for if works are mingled into the justification equation, the principle of grace has been undermined: "But if it is by grace, it is no longer on the basis of works; otherwise grace would no longer be grace" (Rom. 11:6; cf. 4:14-16).
And lest the reply be offered that it is only Jewish ceremonial "works of the law" that cannot justify, both Paul and Peter state that these ethnic boundary markers, which all good Jews meticulously kept, only serve to bind their adherents with an unbearable yoke and curse them along with all who are in Adam. Why would laws that the Judaizers obeyed serve to curse and not justify, unless the point being made is that Israel is but a microcosm of all people who trust in works of any kind to gain God's gracious acquittal?
It seems to me that the Reformed formula of guilt/grace/gratitude does a much better job of guarding the graciousness of the gospel on the one hand, while still retaining a place for holiness and obedience on the other.