The first quotation supports the truth that righteousness comes to all by faith alone by holding up Abraham as the paradigmatic example of this truth. Quoting Gen 15:6, Gal 3:6 states, “Abraham ‘believed God, and it was counted to him as righteousness.’”
Paul used this quote to claim “that it is those of faith who are the sons of Abraham” (Gal 3:7), that is, that anyone who believes is declared righteous by God and truly one of Abraham’s sons. The title “sons of Abraham” was likely used by Jews who claimed that obeying the Mosaic Law was necessary for one to be declared righteous before God. Just as the Law came from those who were the sons of Abraham, so also, they thought, must one obey the Law in order to be a son of Abraham and thus receive the blessing that was first promised to him (cf. Gen 12:3). However, Paul corrected this thinking by basing one’s claim to this title on believing (faith), not doing. Abraham did nothing for God to declare him righteous. He simply believed. (And, the law had not even come yet!)
The second quotation supports the truth that righteousness comes to all by faith alone by noting faith as the means whereby God’s promise of blessing to Abraham is extended to the Gentiles. Conflating Gen 12:3 with Gen 18:18, Gal 3:8 states, “And the Scripture, foreseeing that God would justify the Gentiles by faith, preached the gospel beforehand to Abraham, saying, ‘In you shall all the nations be blessed.’” The original Hebrew of Gen 12:3 technically promises blessing through Abraham to all “families” or “tribes,” but Gen 18:18 (and Paul) gives the sense of these recipients by stating that “all the nations of the earth shall be blessed in” Abraham.
In one sense, the promise of blessing is extended through Abraham (“in you”) to all who have redemption in Christ Jesus, the greatest Descendant of Abraham (Gal 3:14). Closer to home for Gal 3:8 is Gal 3:9, which states as well that it is “those who are of faith” who “are blessed along with Abraham.” So, we could say that we are blessed “in Abraham” through his Descendant Christ Jesus and also by receiving this blessing through the same faith that Abraham exercised so long ago.
As Abraham simply believed and was declared righteous by God, so also it is true that we only need to believe to be declared righteous as well. And this faith is the means whereby God’s blessing of being declared righteous by Him comes to us as Gentiles who make up the nations of the earth.