The verse before was a simple statement of the "good news" of Christ found in the Book of Mormon, framed in the cleanliness needed to be with God in the hereafter. Now, Christ commands us in what needs to be done to be cleansed by the Savior:
20 Now this is the commandment: Repent, all ye ends of the earth, and come unto me and be baptized in my name, that ye may be sanctified by the reception of the Holy Ghost, that ye may stand spotless before me at the last day.
“We believe that the first principles and ordinances of the Gospel are: first, Faith in the Lord Jesus Christ; second, Repentance; third, Baptism by immersion for the remission of sins; fourth, Laying on of hands for the gift of the Holy Ghost.”
Whether you consider the Holy Ghost as a part of the Godhead or just as the influence of God in our lives, this verse points out its power to sanctify. When we commit ourselves to Christ through the outward ordinance of baptism, God acknowledges that commitment by a gift of the Holy Ghost, a constant guide and companion, to help us become better followers of Jesus. Our willingness to follow promptings from the Spirit brings further inspiration - if we ignore those promptings or do wickedly, we drive the Spirit away and are left on our own.
I personally attest to the divine origin of prompting of the Holy Spirit. As I pray and work to be obedient to the Lord's commandments, I have been inspired to do many things that have blessed my life and the lives of others. Of course, I repent and change to improve and I have been baptized and work to keep the commitments I have made to Christ, which makes the regular companionship of the Spirit possible, as Jesus mentions in this verse.