Abraham had the God given gift of faith in God.  That made him righteous in God's sight.  Abraham did good works because God blessed his adopted son of God Abraham to be His and like any Father, God favors His adopted sons with many gifts and blessings in Christ.