Jesus said in Luke 11:13:
If you then, being evil, know how to give good gifts to your children, how much more will your heavenly Father give the Holy Spirit to those who ask Him! Luke 11:13
It is clear then that we need to ask God to receive the Holy Spirit. But is it enough to simply ask? Are there any other conditions that need to be met in order to receive the Spirit of God.
In the book of Acts the apostle Peter said to the Pharisees:
And we are His witnesses to these things, and so also is the Holy Spirit whom God has given to those who obey Him. Acts 5:32
Peter makes it clear that God gives the Holy Spirit to those that obey Him. But what are we supposed to obey?
In Acts 10 Peter was called by God to go and share the truth about Jesus with a Roman centurion, Cornelius, and his men. So Peter went, told them about Jesus and said:
43 To Him all the prophets witness that, through His name, whoever believes in Him will receive remission of sins.”
44 While Peter was still speaking these words, the Holy Spirit fell upon all those who heard the word. 45 And those of the circumcision who believed were astonished, as many as came with Peter, because the gift of the Holy Spirit had been poured out on the Gentiles also. Acts 10:43-45
Remember it was Peter that told the Pharisees that God gives the Spirit to those that obey him. Because God gave the Spirit to the Cornelius and the gentiles we can only conclude that they were obeying God. But how were they obeying God. From the context it is clear that when they were told that they needed to believe in Jesus they obeyed.
We can draw a conclusion from their experience. The gentiles chose to be obedient to the word of God as it was given to them through the apostle Peter. As a result of their response of obedience to the word of God they received the Spirit. This means that when you and I are obedient to the word of God, whether we hear it or read it we will receive the Holy Spirit.
Do you want to receive the Holy Spirit? If so then God is challenging you to be obedient to His word. It isn't always easy to be obedient, but God promises the tremendous blessing of His Spirit if we choose to submit to His word.