Receive the Holy Spirit

And Peter said to them, “Repent and be baptized every one of you in the name of Jesus Christ for the forgiveness of your sins, and you will receive the gift of the Holy Spirit. -- Acts 2:38 (ESV)

Why we need the Holy Spirit

Jesus answered, “Truly, truly, I say to you, unless one is born of water and the Spirit, he cannot enter the kingdom of God. That which is born of the flesh is flesh, and that which is born of the Spirit is spirit. Do not marvel that I said to you, ‘You must be born again.’ The wind blows where it wishes, and you hear its sound, but you do not know where it comes from or where it goes. So it is with everyone who is born of the Spirit.” -- John 3:5-8 (ESV)

Paul explains in more detail:

There is therefore now no condemnation for those who are in Christ Jesus. For the law of the Spirit of life has set you free in Christ Jesus from the law of sin and death. For God has done what the law, weakened by the flesh, could not do. By sending his own Son in the likeness of sinful flesh and for sin, he condemned sin in the flesh, in order that the righteous requirement of the law might be fulfilled in us, who walk not according to the flesh but according to the Spirit.

Flesh Spirit
For those who live according to the flesh set their minds on the things of the flesh ... ... but those who live according to the Spirit set their minds on the things of the Spirit.
For to set the mind on the flesh is death ... ... but to set the mind on the Spirit is life and peace.
For the mind that is set on the flesh is hostile to God, for it does not submit to God’s law; indeed, it cannot. Those who are in the flesh cannot please God. You, however, are not in the flesh but in the Spirit, if in fact the Spirit of God dwells in you.
Anyone who does not have the Spirit of Christ does not belong to him. But if Christ is in you...
... although the body is dead because of sin... ... the Spirit is life because of righteousness.

If the Spirit of Him who raised Jesus from the dead dwells in you, He who raised Christ Jesus from the dead will also give life to your mortal bodies through His Spirit who dwells in you.

So then, brothers, we are debtors, not to the flesh, to live according to the flesh. For if you live according to the flesh you will die, but if by the Spirit you put to death the deeds of the body, you will live.

For all who are led by the Spirit of God are sons of God. For you did not receive the spirit of slavery to fall back into fear, but you have received the Spirit of adoption as sons, by whom we cry,

“Abba! Father!”

The Spirit himself bears witness with our spirit that we are children of God, and if children, then heirs — heirs of God and fellow heirs with Christ, provided we suffer with him in order that we may also be glorified with him.

For I consider that the sufferings of this present time are not worth comparing with the glory that is to be revealed to us. For the creation waits with eager longing for the revealing of the sons of God. For the creation was subjected to futility, not willingly, but because of him who subjected it, in hope that the creation itself will be set free from its bondage to corruption and obtain the freedom of the glory of the children of God. For we know that the whole creation has been groaning together in the pains of childbirth until now.

And not only the creation, but we ourselves, who have the firstfruits of the Spirit, groan inwardly as we wait eagerly for adoption as sons, the redemption of our bodies. For in this hope we were saved. Now hope that is seen is not hope. For who hopes for what he sees? But if we hope for what we do not see, we await for it with patience.

Likewise the Spirit helps us in our weakness. For we do not know what to pray for as we ought, but the Spirit himself intercedes for us with groanings too deep for words. And he who searches hearts knows what is the mind of the Spirit, because the Spirit intercedes for the saints according to the will of God.

And we know that for those who love God all things work together for good, for those who are called according to his purpose.

For those whom he foreknew he also predestined to be conformed to the image of his Son, in order that he might be the firstborn among many brothers. And those whom he predestined he also called, and those whom he called he also justified, and those whom he justified he also glorified.

-- Romans 8:1-30 (ESV)

How to earn the Holy Spirit

You do not.

Now when Simon saw that the Spirit was given through the laying on of the apostles’ hands, he offered them money,

saying, “Give me this power also, so that anyone on whom I lay my hands may receive the Holy Spirit.”
But Peter said to him, “May your silver perish with you, because you thought you could obtain the gift of God with money! You have neither part nor lot in this matter, for your heart is not right before God. Repent, therefore, of this wickedness of yours, and pray to the Lord that, if possible, the intent of your heart may be forgiven you.”

-- Acts 8:18-22 (ESV)

Instead...

... when the goodness and loving kindness of God our Savior appeared, He saved us, not because of works done by us in righteousness, but according to His own mercy, by the washing of regeneration and renewal of the Holy Spirit, whom He poured out on us richly through Jesus Christ our Savior, so that being justified by his grace we might become heirs according to the hope of eternal life. -- Titus 3:5

How the Holy Spirit was received

Laying of hands

Now when the apostles at Jerusalem heard that Samaria had received the word of God, they sent to them Peter and John, who came down and prayed for them that they might receive the Holy Spirit, for he had not yet fallen on any of them, but they had only been baptized in the name of the Lord Jesus. Then they laid their hands on them and they received the Holy Spirit. -- Acts 8:17 (ESV)

On hearing this, they were baptized in the name of the Lord Jesus. And when Paul had laid his hands on them, the Holy Spirit came on them, and they began speaking in tongues and prophesying. -- Acts 19:5-6 (ESV)

Do not neglect the gift you have, which was given you by prophecy when the council of elders laid their hands on you. -- 1 Timothy 4:11 (ESV)

For this reason I remind you to fan into flame the gift of God, which is in you through the laying on of my hands, for God gave us a spirit not of fear but of power and love and self-control. -- 2 Timothy 1:4 (ESV)

Baptism is not a prerequisite

Paul received the Holy Spirit before he got baptized.

So Ananias departed and entered the house. And laying his hands on him he said, “Brother Saul, the Lord Jesus who appeared to you on the road by which you came has sent me so that you may regain your sight and be filled with the Holy Spirit.” And immediately something like scales fell from his eyes, and he regained his sight. Then he rose and was baptized; and taking food, he was strengthened. -- Acts 9:17 (ESV)

Another example is the Gentiles that received the Holy Spirit before they got baptized:

While Peter was still saying these things, the Holy Spirit fell on all who heard the word. And the believers from among the circumcised who had come with Peter were amazed, because the gift of the Holy Spirit was poured out even on the Gentiles. For they were hearing them speaking in tongues and extolling God. Then Peter declared, “Can anyone withhold water for baptizing these people, who have received the Holy Spirit just as we have?” And he commanded them to be baptized in the name of Jesus Christ. -- Acts 10:44-48

The difference that the Holy Spirit makes

Some would claim that if you do not speak in tongues or perform miracles, you did not receive the Holy Spirit. However, John teaches a different standard:

-- 1 John 4:12-16 (ESV)