Now behold, one came and said to Him, “Good Teacher, what good thing shall I do that I may have eternal life?” So He said to him, "... if you want to enter into life, keep the commandments.” (Luke 18:18-19)
In essence, Jesus replies "Do this and live." He was telling the rich young ruler that in order to obtain eternal life one needs a perfect obedience before the law of God. Jesus's law formula, if you will, wasn't at odds with his gospel. It was and still is the foundation upon which one obtains eternal life. "What?" you say! Yes, it's the very ground upon which Jesus obtained eternal life for the elect. He 'did' the "Do this and live" of the law for all those who put their trust in him for salvation. His obedience is credited to them as their obedience. His death for the sins of the elect is credited as their death for their sins. Jesus fulfilled all the righteous demands of the law of commandments and thus earned eternal life for those he came to save.
"Do this and live" (Lev. 18:5) is the promise/works principle embodied in the Edenic covenant of works and later echoed in the Mosaic Covenant at Mt. Sinai as the condition upon which God would temporally bless Israel in the land of Canaan as well as to direct the people to the mercy offered in Christ. It was also the Law of works under which Jesus was born. God was still looking for a Man - the true Israel/the second Adam - to fulfill the covenant of creation which offered lif upon perfect obedience. The first Adam had failed when he disobeyed and ate of the Tree of the Knowledge of Good and Evil, hurling all mankind into sin and under condemnation. Though not under a strict covenant of works by which to obtain eternal life, Israel as a nation broke the Sinai covenant which contained a shadow of the original works covenant made with Adam. Thus the Israelites were exiled by God from the promise land even as Adam was exiled from the Garden of Eden. As the writer in Hosea 6:7 declares,
But like Adam they [i.e. Israel] have transgressed the covenant;
There they have dealt treacherously against Me.
Is it really such a stretch to see that the conditional promise of life based on obedience offered by Jesus to the rich young ruler is the very same condition of obedience for life that Adam transgressed in the original covenant of works in Genesis 3, and the same works principle typologically and pedagogically republished to Israel as a nation in the Mosaic covenant? Can it be that God is trying to get our attention? And can it be that God has writ large in Scripture that for one to "have eternal life," then obedience to all the Law must be performed. And that complete and necessary obedience comes either by one's own personal works or through the One who has performed that obedience for all who receive him by faith.