It can be seen clearly from the context of this passage that Cornelius believed and so was saved prior to the moment of his baptism. Having heard the gospel, Cornelius received the Spirit of God prior to getting baptized. That is a sure indication that he believed what he heard.
Baptism is not a mere formality. It serves as a reminder of our new identity in Jesus Christ. We are supposed to reflect on our baptism with the intent of building up our faith. Baptism is a picture of dying to sin in order to live for Christ.