Peter is not claiming that baptism in the name of Jesus Christ automatically conveys the Spirit to those being baptized. Elsewhere in Acts the gift of the Spirit sometimes precedes and sometimes follows baptism.1 This confirms that Peter’s primary aim is not to provide a detailed order of salvation.
Instead he uses sacramental language to emphasize the close connection between the sign (baptism) and the thing signified (forgiveness of sins and the gift of the Spirit). The use of sacramental language is meant to assure believers that if we have faith in Jesus Christ, we are as truly cleansed from our sins spiritually as we are bodily washed with water.
38 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.