I was looking at this passage in the Bible:
I was hungry and you fed me, thirsty and you gave me a drink; I was a stranger and you received me in your homes, naked and you clothed me; I was sick and you took care of me, in prison and you visited me.’ “The righteous will then answer him, ‘When, Lord, did we ever see you hungry and feed you, or thirsty and give you a drink? When did we ever see you a stranger and welcome you in our homes, or naked and clothe you? When did we ever see you sick or in prison, and visit you?’ The King will reply, ‘I tell you, whenever you did this for one of the least important of these members of my family, you did it for me!’
Will people like Gandhi, Tha Dali Lama, and other people who live to serve in soup kitchens and homeless shelters dedicating their lives to peace be given eternal life?
Well, I'd put it like this: A person who lived in such perfect communion with God and in total perfect justice is a person who wouldn't need saving.
So the question "can a person be saved by living righteously" doesn't necessarily make sense.
The reason why Christianity has always rejected the idea that a person can "be saved" by one's own righteous works or merit is because human beings, estranged from God, don't live in perfect communion with God and in total perfect justice. Find the best of the best of our species, and you still have a broken sinner in need of God's grace.
Our Lord Jesus, uniquely, is the only human person who has accomplished that, and He's God.
What our Lord's words in Matthew 25 teach us isn't that if we just try really hard we can attain glory; but rather is Law (and the Law cannot make one righteous). What does that mean then? That means that as Law it:
1) Establishes what is right and good and ought to be done.
2) In establishing what ought to be done, demonstrates our own failure to do it, we haven't treated the least of these the way Christ says we should, but we have universally failed to do this.
3) Now by the grace of God, living in the faith we have been given from God, this is how we ought to conduct ourselves in this life.
That is the force of the Law. And it is the same here as anywhere else we find the solemn command of our Lord and God: The Law establishes justice, reveals that we are unjust, and then establishes for us as God's people the rule by which we ought to live.
It is in the fact that we fail to obey the Law that the trouble arises. That's sin, that's the common and universal malady of all mankind. That's why the Law does not justify, but rather condemns us. See what the Apostle St. Paul says in Romans ch. 7.
And so that is the reason why St. Paul says what he says throughout all his epistles, that no one can be found righteous by the Law, but can only be justified by God's grace, which is freely given through faith; and that is a faith which we receive by the word of God. Thus our salvation comes from God alone, who accomplishes this good for us in and by Jesus Christ our Savior who has reconciled us to God, establishing peace, forgiving us all of our sins, and reckoning us just as pure grace.
-CryptoLutheran