Compare what Moses says and what Paul says about righteousness.
Moses:
"The Lord your God will make you abundantly prosperous in all the work of your hand, in the fruit of your womb and in the fruit of your cattle and in the fruit of your ground. For the Lord will again take delight in prospering you, as he took delight in your fathers, when you obey the voice of the Lord your God, to keep his commandments and his statutes that are written in this Book of the Law, when you turn to the Lord your God with all your heart and with all your soul" (Deuteronomy 30:9-10 ESV)
If you do these you will live and be prosperous. "Moses writes about the righteousness that is based on the law, that the person who does the commandments shall live by them..." (Romans 10:4-5 ESV). If you do not you will surely perish (Deuteronomy 30:17 ESV).
"For this commandment that I command you today is not too hard for you, neither is it far off. It is not in heaven, that you should say, ‘Who will ascend to heaven for us and bring it to us, that we may hear it and do it?’ Neither is it beyond the sea, that you should say, ‘Who will go over the sea for us and bring it to us, that we may hear it and do it?’ But the word is very near you. It is in your mouth and in your heart, so that you can do it" (Deuteronomy 30:11-14 ESV)
Paul:
"For Christ is the end of the law for righteousness to everyone who believes. For Moses writes about the righteousness that is based on the law, that the person who does the commandments shall live by them. But the righteousness based on faith says, “Do not say in your heart, ‘Who will ascend into heaven?’” (that is, to bring Christ down) “or ‘Who will descend into the abyss?’” (that is, to bring Christ up from the dead). But what does it say? “The word is near you, in your mouth and in your heart” (that is, the word of faith that we proclaim); because, if you confess with your mouth that Jesus is Lord and believe in your heart that God raised him from the dead, you will be saved. For with the heart one believes and is justified, and with the mouth one confesses and is saved" (Romans 10:4-10 ESV)
Summary
The righteousness based upon faith (unlike that of the written commandments which says if you do them you will live) is believing in your heart, whereby through faith we are justified and made righteous. This is our confession in Christ, confessing with our mouths the same words of faith that are in our hearts. "For by grace are we saved through faith, it is a gift of God, not of works lest we boast" (Ephesians 2:8-9).
Faith was available to Israel "the word is very near you. It is in your mouth and in your heart, so that you can do it" but they did not pursue righteousness from faith. This Jesus said about the religious leaders, they cleansed the outside of the cup while neglecting the inside. They were like the fig tree Jesus cursed, it looked from a distance like a healthy tree but it did not bear fruit. Fruit or works did not overflow from faith, believing in the heart, but as if it were based upon works. Or said another way works did not flow from faith (which we are accounted righteous) but from self-righteousness.
But what does righteousness from faith say? “The word is near you, in your mouth and in your heart” (that is, the word of faith that we proclaim); because, if you confess with your mouth that Jesus is Lord and believe in your heart that God raised him from the dead, you will be saved. For with the heart one believes and is justified, and with the mouth one confesses and is saved (Romans 10:8-10 ESV)
Now, Paul writes, what do you say to this, that the Gentiles who did not pursue righteousness obtained it and the Jew who pursued righteousness did not obtained it? "Why? Because they did not pursue it from faith, but as if it were based on works. They have stumbled over the stumbling stone, as it is written, 'Behold, I am laying in Zion a stone of stumbling, and a rock of offense; and whoever believes in him will not be put to shame.'” (Romans 9:31-33 ESV)