Jesus Christ said:
And he said unto him, Why callest thou me good? there is none good but one, that is, God: but if thou wilt enter into life, keep the commandments.
And it is consistent with God's plan of salvation from the beginning:
The LORD shall establish thee an holy people unto himself, as he hath sworn unto thee, if thou shalt keep the commandments of the LORD thy God, and walk in his ways.
And it is easy to see then that God chooses to save the obedient:
And being made perfect, he became the author of eternal salvation unto all them that obey him;
And it is clear that if we do not keep His Commandments, we will not even be justified:
(For not the hearers of the law are just before God, but the doers of the law shall be justified.
One thing must be perfectly clear however. We do not obligate God to save us because we claim to keep His Commandments:
Knowing that a man is not justified by the works of the law, but by the faith of Jesus Christ, even we have believed in Jesus Christ, that we might be justified by the faith of Christ, and not by the works of the law: for by the works of the law shall no flesh be justified.
For salvation is the gift of God to whom He wishes to give it.
For by grace are ye saved through faith; and that not of yourselves: it is the gift of God:
And He revealed that He gives it to those who keep His commandments.
And shewing mercy unto thousands of them that love me, and keep my commandments.
God obligated Himself when He made the promise:
2 Corinthians 7:1
Having therefore these promises, dearly beloved, let us cleanse ourselves from all filthiness of the flesh and spirit, perfecting holiness in the fear of God.
And what is the promise?
For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.
And how did He accomplish our salvation?
2 Corinthians 5:15 And that he died for all, that they which live should not henceforth live unto themselves, but unto him which died for them, and rose again.
Therefore, St. Paul said:
Galatians 2:20I am crucified with Christ: nevertheless I live; yet not I, but Christ liveth in me: and the life which I now live in the flesh I live by the faith of the Son of God, who loved me, and gave himself for me.