It’s true: social justice and the gospel are not the same thing; but we must recognize that the pursuit of social justice is the inevitable fruit of the gospel. It is very important that we make a clear distinction between the gospel and its fruit. But it is equally important that we recognize the necessary relationship between what Jesus accomplished in his life, death, and resurrection (namely, reconciliation between God and man) and the Christian’s pursuit of social justice for the weak and marginalized. This necessary relationship between the gospel and social justice is what is behind James 1:27.
Religion that is pure and undefiled before God, the Father, is this: to visit orphans and widows in their affliction, and to keep onself unstained from the world.
James is not saying that visiting orphans and widows in their affliction is the gospel. Rather, he is saying that visiting orphans and widows is the necessary fruit of the gospel. While it is absolutely essential that we do not confuse social action with the gospel, it is equally essential that we see the pursuit of social justice as the beautiful and Jesus-honoring fruit of the gospel. I agree with Graeme Goldsworthy:
The concerns of Christians for social justice must be worked out in the framework of the gospel. This of course raises a number of issues as to the mode of our action and what we seek to achieve. While it is true that modern evangelicals have often reacted against the social justice issue because of the liberal agenda that confuses social action with the gospel, it ought to be recognized that evangelical religion has been one of the greatest motivations for social action in modern history. The [OT] prophets never see the answer to the social issues in any way other than through the saving work of God (Graeme Goldsworthy, Preaching the Whole Bible as Christian Scripture, 177).