Romans 5:1 Therefore having been justified out of faith, we have peace with God through our Lord Jesus Christ:
2 through whom also we came into possession of, and still have, access by faith into this grace in which we have stood and continue to stand, and rejoice in hope of the glory of God.
3 And not only so, but we rejoice in afflictions also: knowing that afflictions bring forth endurance;
4 And endurance approval; and approval hope:
5 And hope doesn't shame us; because God's love has been poured out in our hearts through the Holy Spirit who has been given to us.
So then, we have been made just and right with God. This follows Paul's conclusion at the end of chapter 4.
4:23 it was not written for his sake only, that it was imputed to him; 24 But for us also, to whom it will be imputed, to those believing on him that raised up Jesus our Lord from the dead; 25 Who was delivered for our offences, and was raised for our justification.
So how have we been made just and right?
"Therefore" is also a consequence of the whole discussion of justification going back to chapter 3. The statement that we have been justified "out of/by means of faith" takes us back to Paul's concept of the "faith of Christ."
3:22 and the righteousness of God which is through the faithfulness of Jesus Christ unto all the ones believing: for there is no difference:
25 Whom God set forth to be a propitiation through (his) faithfulness, by means of his blood, to declare his righteousness, because God in his forbearance passed over the sins that are past,
Christ, as he gave himself, was faithful. And we are saved by his faithfulness.
Eph 3:12 In whom we have the boldness and access with confidence through his faithfulness
Galatians 2:16 Knowing that a man is not justified out of the source(by means) of the works of the law, but through the faithfulness of Jesus Christ, even we believed unto Christ Jesus , that we might be justified out of/by means of the faithfulness of Christ, and not out of the works of the law: for out of the works of the law no one will be justified.
In Paul's thought, there is a relationship that exists: out of/by means of the faithfulness of Christ unto faith/believing.
1:17 For the righteousness of God is being revealed in it out of faith(fulness) leading to faith(fulness): as it is written, The one who is just out of faithfulness will live.