First and foremost, righteousness is an attribute of God: “For the LORD is righteous” (Psalm 11:7). The fact that God is righteous means that he “always acts in accordance with what is right and is himself the final standard of what is right” (Wayne Grudem, Systematic Theology). Righteousness is a statement about God’s moral nature and it means that he never does wrong. More than that, God’s righteousness means that he cannot do wrong.
For man, righteousness is a measure of morality just as it is for God, but man has no part in defining what is right. Man is righteous only as much as his morality, expressed in desires, thoughts, and deeds, conforms to that of God’s. Where he differs with God, he is unrighteous.
Scripture is clear that because Adam’s sin has corrupted every man, “none is righteous, no, not one” (Romans 3:10; cf. Psalm 14:1-3). But it is also clear that Jesus Christ lived a perfectly righteous life and died for our sins in order to free us from our punishment and credit us with his own righteousness—the righteousness of God (see 1 Corinthians 1:30; 2 Corinthians 5:21). This is the gospel.