When Moses presents the Ten Commandments to the nation of Israel, he teaches the importance of obeying them:
You should diligently keep the commandments of the Lord your God, and His testimonies and His statutes which
He has commanded you. You shall do what is right and good in the sight of the Lord, that it may be well with you and that you may go in
and possess the good land which the Lord swore to give your fathers, by driving out all your enemies from before you, as the Lord has
spoken. (Deut 6:17-19).
"Doing right" meant obeying and following the word of God.
God's word, an objective standard which is outside of and an authority above a human being, is the means by which a
person is evaluated for moral goodness. It is not a subjective standard in which God chooses who is righteous or not.
God’s word demonstrates that God Himself is the moral standard and authority of moral goodness.
It is from this perfect moral Being that the only behavior that could be expressed is righteous.
Just as God's word is the objective means of determining moral goodness, the judicial process is objective; God does
not judge capriciously or subjectively. This is why God's judgment is considered righteous (Deut 4:6-8;
Rom 2:5; Rev 16:7).
This is a plain indication of God's righteous judgment so that you will be considered worthy of the kingdom of
God, for which indeed you are suffering. For after all it is only just for God to repay with affliction those who afflict you, and to
give relief to you who are afflicted and to us as well when the Lord Jesus will be revealed from heaven with His mighty angels in
flaming fire, dealing out retribution to those who do not know God and to those who do not obey the gospel of our Lord Jesus.
(2 Thess 1:5-8)
To learn more, see:
What does it mean "God is righteous?"