Commentators are unanimous: these acts of mercy are not how you earn salvation. Rather, they are the necessary evidence of a heart transformed by God's grace. As Charles Spurgeon notes, "our works are the evidences of our being saved." The kingdom is an inheritance given by God (as mentioned in v. 34), and these actions simply demonstrate that one truly belongs to His family.