It’s been very common to use the words ‘law’ and ‘gospel’ in the following way:
Gospel = promises that save
Law = legal demands that condemn
That’s all ok to some extent as systematic categories. But frankly unhelpful if used as an absolutising gloss for how to understand the words ‘gospel’ and ‘law’ as the NT actually uses them. Romans 2 is a good example of why this is so.
1. Note the way Paul uses ‘gospel.’
v16 – the gospel includes the news of judgment day, and the way that that judgment day will proceed. This should be no surprise for the gospel according to Paul is an announcement about Jesus, God’s Son, that he is Christ and Lord (1:4). As such he will one day judge the secrets of men (2:16).
In this sense, the gospel can be either ‘law’ or ‘gospel’ (in the senses meant above) for someone, depending on whether or not they have faith in Christ. The gospel warns us of our condemnation at the judgment throne of Jesus Christ the Lord.
2. Note the function of the law within this announcement of the gospel
The gospel announces the way that that judgment day will proceed –including the fact that judgment is according to works (v6). Paul speaks very clearly in v7, 10, 13-14, 26, 28-29, of the evidential role that law-keeping will play in God’s final verdict of those who are righteous. Those who are given eternal life on the final day are thus given according (not on the basis of/ as earned by) to their works.
Put another way, the gospel tells me that as judge the Lord Jesus will use the law (2:13) and our obedience or disobedience of it as a yardstick for exposing the reality of our hearts come judgment day.
Again, to use systematic categories borrowed from elsewhere in the reformed tradition, we could say that the gospel includes the announcement that the 3rd use of the law will be very relevant (as evidence) on judgment day. In this sense, the necessity of obedience to law is included in the gospel announcement.
3. Note the role of the law in salvation
Salvation, and more specifically, the inward-reviving, life-giving, regenerating work of the Spirit, is described in this passage in terms of an internalisation of the law. The heart is circumcised, and the ‘work of the law’ is written on the heart (v15, v29). This itself is evidenced by obedience to the law in the lifestyle of the regenerate, hence why obedience and deeds function the way they do on judgment day. But what’s mostly of note here for our purposes is simply the fact that salvation can be described in relation to the law, whilst at the same time it is being made abundantly clear that it is not mere possession of the written law that does this internalising work but rather the Spirit.
And, if anyone is still confused, let me strongly assert: We are justified by faith alone in Christ alone, and not on the basis of any works we have done. Salvation is entirely of grace, we can merit/ deserve/ earn nothing. Our works function on judgment day as the evidence that we are those who have put our trust in Christ. All I’m saying is that James and Paul agree.