Under the law securing an eternity with the Lord and not spending eternity burning in the lake of fire was set up differently than it is now under grace.
A confusion enters here: Someone asked Jesus (while under the law): Matthew 19:16, 17 “And, behold, one came and said unto him, Good Master, what good thing shall I do, that I may have eternal life? 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.” You might say, this was a trick question. He did not ask what is needed to have eternal life. He asked, “what good thing shall I do, that I may have eternal life?” That is where confusion starts.
It might seem well founded, if you don’t know enough about the scriptures. Simple requirement under the law: Leviticus 18:4, 5 “Ye shall do my judgments, and keep mine ordinances, to walk therein: I am the LORD your God. Ye shall therefore keep my statutes, and my judgments: which if a man do, he shall live in them: I am the LORD.”
These are the “works” to do. But the works or deeds of the law are not going to get you to heaven. (I’m still talking old testament, under the law) Romans 3:20 “Therefore by the deeds of the law there shall no flesh be justified in his sight: for by the law is the knowledge of sin.” The deeds or works did not and will not get anyone into heaven.
Habbakuk 2:4 “Behold, his soul which is lifted up is not upright in him: but the just shall live by his faith.” The law had to be “attempted” to be done perfectly as a demonstration and exercise of truly seeking him and his ways. But it had to be done by faith. Not the faith that says, “Jesus died for me, I’ll trust him.” But a faith that said, “God said to do these things, so I will try and live in them, trusting that, though I will fail, he will have a way to get me to him.” But if you would not try to do the works and live in the holy law, you were not really seeking him.
Under the law blood sacrifices and offerings of many kinds were prevalent. They did not save anyone. Hebrews 10:4 “For it is not possible that the blood of bulls and of goats should take away sins.” These sacrifices did not take away sin, but covered it for the time being. That is also why, when the old testament saints died they went to paradise in the center of the earth, not heaven. Their sin was covered, not taken away.
John 1:29 “The next day John seeth Jesus coming unto him, and saith, Behold the Lamb of God, which taketh away the sin of the world.” When Jesus paid the price of his precious blood (and presented his risen body to the Father), the salvation of old testament saints was complete.
So under the law eternal life came by walking in the law of God by faith, trusting his sacrifice system and mercy to not give you what the law showed you you really deserved.
Works are not “Wow, you built an orphanage, you deserve heaven!” Works are showing you trust the LORD, seek him and want his ways. But it’s still his grace that keeps anyone out of the lake of fire!