“This only I want to learn from you: Did you receive the Spirit by the works of the law, or by the hearing of faith?”
Paul now asks three questions that point to faith as God’s principle for dealing with God’s people. The first question concerns how we received the Spirit—through works or faith.
This only I want to learn from you:
Paul concedes only two possibilities whereby the Galatians received the Spirit. He extends to the Galatians the option of teaching them by answering his question. These two options are mutually exclusive. Did they receive the Spirit either by works or by faith? Paul draws a line in the sand. This question decisively establishes faith as the way of receiving God’s grace. Paul can rest his case on this point alone.
Did you receive the Spirit
Paul presumes that the Galatians are Christians because they received the Spirit at some point. The argument of the book of Galatians comes from the perspective of a Christian who reverts to legalism. He allows no other option.
“Now we have received, not the spirit of the world, but the Spirit who is from God, that we might know the things that have been freely given to us by God” (1 Corinthians 2:12).
Receiving the Spirit means receiving the presence of the living Christ. The word “receive” is a term of grace. We cannot earn salvation or sanctification.
“…he said to them, “Did you receive the Holy Spirit when you believed?” So they said to him, “We have not so much as heard whether there is a Holy Spirit” (Acts 19:2).
by the works of the law,
The word “of” in the phrase “of the law” refers to the source: “Did you get the Holy Spirit from the works of the law?” The Galatians were Gentiles and did not know the law. They obviously did not become Christians through the law. After Paul left the region, they heard of the law as a way of sanctification.
or by the hearing of faith?
Galatians’ experience flew in the face of salvation or sanctification by works. Clearly, they received the Spirit by faith. God saves us because of who Jesus is and what He did, not because of who we are or what we’ve done.
“By the hearing” here refers to the act of hearing or to the willingness to listen by faith. We must have a desire to listen to grace. People love to hear what makes them feel good: a message of salvation by works. Faith is the absence of works. The merit is God’s because God did the work through Christ.
“So then faith comes by hearing, and hearing by the word of God” (Romans 10:17).
The answer is patently clear, as we will see in this chapter and the next: they received the Spirit through the “hearing of faith.” The Christian receives the Holy Spirit at the moment of salvation by faith. We cannot separate the indwelling Holy Spirit from our new birth in Christ.
“In Him you also trusted, after you heard the word of truth, the gospel of your salvation; in whom also, having believed, you were sealed with the Holy Spirit of promise, who is the guarantee of our inheritance until the redemption of the purchased possession, to the praise of His glory” (Ephesians 1:13-14).
The Holy Spirit is the “guarantee” of our salvation. He is our down payment, earnest money, that pledges the purchase of our salvation.
The word “of” precedes “works” and “faith,” again emphasizing the source in Greek. Paul’s great concern is the source of salvation and sanctification.
Principle:
We receive the Holy Spirit by faith at the point of salvation.
Application:
No special conditions are required to receive the Spirit. We receive Him by faith at the moment of salvation. The Holy Spirit is not the end of the Christian life but the source for living that life. We do not receive the Spirit because we live the Christian life; we receive Him by faith when we accept Christ’s finished work on the cross. He is not the product of the Christian life but the power behind it. When we yield to Him, we engage supernatural power to walk with God.
Further, there is no split between salvation by faith and sanctification by faith. Some teach that God saves us by faith but sanctifies us by works. The Bible argues that a person becomes a Christian by faith and lives the Christian life by faith. Faith is sufficient to save and sanctify.
Only one condition matters for receiving the Holy Spirit: faith. Law stipulates that we live by works, but grace insists we live by faith.
We do not receive the Spirit on the installment plan. We receive Jesus as Savior and the Holy Spirit as the one who indwells us at the moment of salvation (1 Corinthians 12:13; 2 Timothy 1:14). We do not receive the Spirit through tears of repentance, keeping the golden rule, or the Mosaic Law, but by believing in Jesus Christ. No experience, keeping taboos, or crucifying the self can help us receive the Spirit.

Thanks for the commentary! I was looking at this passage because I don't agree with the reformed position that a volitional change of mind, the exercise of faith, is a work.
Andy, the word "to believe" or "to exercise faith" is a transitive verb. A transitive verb requires an object. It is not faith that saves us but where we place our faith. It is in the finished work of Christ. Thus, faith is a non-meritorious exercise whereby we trust what Christ did–not what we do.
Thank you, Grant. Receiving the Spirit and believing are simultaneous. We receive the Spirit at the moment we’re born again: made spiritually alive BY the Spirit, not receive the Spirit because we first believe. Many seem to be confused about this, thinking their faith is some sort of meritorious that qualifies them to receive the Spirit.