When we look back in hindsight, we do see an element of grace through faith, but the basic element was following the Torah, which is not limited to the Ten Commandments.
Luke 18:18-30 (NIV2011)
18 A certain ruler asked him, “Good teacher, what must I do to inherit eternal life?”
19 “Why do you call me good?” Jesus answered. “No one is good—except God alone.
20 You know the commandments: ‘You shall not commit adultery, you shall not murder, you shall not steal, you shall not give false testimony, honor your father and mother.’”
21 “All these I have kept since I was a boy,” he said.
22 When Jesus heard this, he said to him, “You still lack one thing. Sell everything you have and give to the poor, and you will have treasure in heaven. Then come, follow me.”
23 When he heard this, he became very sad, because he was very wealthy.
24 Jesus looked at him and said, “How hard it is for the rich to enter the kingdom of God!
25 Indeed, it is easier for a camel to go through the eye of a needle than for someone who is rich to enter the kingdom of God.”
26 Those who heard this asked, “Who then can be saved?”
27 Jesus replied, “What is impossible with man is possible with God.”
28 Peter said to him, “We have left all we had to follow you!”
29 “Truly I tell you,” Jesus said to them, “no one who has left home or wife or brothers or sisters or parents or children for the sake of the kingdom of God
30 will fail to receive many times as much in this age, and in the age to come eternal life.”
The Rich Young Ruler: Good Master, What must I do to inherit Eternal Life?
Jesus: Do not call me Good unless you mean it. Have you followed the Law?
RYR: I have from my youth.
Jesus: One thing do you lack. Sell all that you have, give the money to the needy, AND Follow Me.
The Rich Young Ruler was very sad because he was very rich. He could not enter into the Kingdom of Heaven because he failed to follow Jesus.