“For in the gospel the righteousness of God is revealed – a righteousness that is by faith from first to last, just as it is written: ‘The righteous will live by faith.'” -Romans 1:17

Whenever Paul says, “it is written,” it should jump out at you immediately that he is talking about the Old Testament. This being the case, when he says this, quite often it’s to refer back to the Old Testament to point out some prophecy or truth that was fulfilled with Christ’s life, death and resurrection.

The phrase, “the righteous will live by faith,” is a reference to Habakkuk 2:4 (See my note, “On The Bloating of Pride, Sin, and In Which You’ll Read a Few Notes Concerning Biblical Humor”). The first referring to Christ, that by His faith He will be made righteous, the first fruits of this righteousness. The second referring to that those who have faith on Christ will share in His righteousness.
In addition, this phrase shows us where obedience comes from, and that is faith. Faith and a relationship with God does not come from obedience (See my note, “On Obedience and Faith,” Romans 1:5).