Those who are in Christ are obligated to walk in the same way he walked (1 John 2:6), so being declared righteous in Christ means being declared someone who practices righteousness by walking in obedience to God'a law. Obedience to God's law is the content of God's free gift of salvation, not the way to earn it.Exactly...God’s saving action in Christ, is how we are declared to be legally just, it combines his judgment against sin and his free gift of salvation.
The Bible repeatedly refers to God's law as being God's way, such as in Deuteronomy 10:12-13, Isaiah 2:2-3, Joshua 22:5, 1 Kings 2:1-3, Psalms 103:7, Psalms 119:1-3, and many others.That's God's way. Then there's man's way:
In Exodus 33:13, Moses wanted God to be gracious to him by teaching him to walk in His way that he and Israel might know Him, and in Matthew 7:23, Jesus said that he would tell those who are workers of lawlessness to depart from him because he never knew them, so knowing God and Jesus is he goal of the law, which is eternal life (John 17:3).For being ignorant of the righteousness that God ascribes [which makes one acceptable to Him in word, thought, and deed] and seeking to establish a righteousness (a means of salvation) of their own, they did not obey or submit themselves to God’s righteousness. Romans 10:3
A contrast between doing and believing is established in Romans 9:30–33
“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’ ”. In trying to establish their own righteousness based on works, people stumble over the Jesus they fail to believe in His work on the cross as being sufficient. In their pursuit of righteousness based on works, they have missed Christ the author and finisher of our faith.
In Romans 9:30-10:4, they had a zeal for God, but it was not based on knowing Him, so they failed to attain righteousness because they misunderstood the goal of the law by pursuing it as through righteousness were earned as the result of their works in order to establish heir own instead of pursuing God's law as through righteousness were by faith in Christ, for knowing Christ is the goal of the law for righteousness for everyone who has faith. So this passage is not making a contrast between believing and doing, but rather it is making a contrast between obeying God's law with the correct or incorrect goal.