1 Peter 3:18-22 (ESV)
For Christ also suffered once for sins, the righteous for the unrighteous, that he might bring us to God, being put to death in the flesh but made alive in the spirit,  in which he went and proclaimed to the spirits in prison,  because they formerly did not obey, when God's patience waited in the days of Noah, while the ark was being prepared, in which a few, that is, eight persons, were brought safely through water.  Baptism, which corresponds to this, now saves you, not as a removal of dirt from the body but as an appeal to God for a good conscience, through the resurrection of Jesus Christ,  who has gone into heaven and is at the right hand of God, with angels, authorities, and powers having been subjected to him.
Baptism, which corresponds to this, now saves you, not as a removal of dirt from the body but as an appeal to God for a good conscience, through the resurrection of Jesus Christ. According to the rules of logic and grammar you can drop the phrase “which corresponds to this,” without doing violence to the subject/predicate relationship of the sentence. In other words the subject here is Baptism, the predicate is “now saves you.” The basic sentence reads Baptism now saves you. Baptism now saves you, just as the ark Noah built saved eight by bringing them through the water.
Peter uses typology here to look back at the Old Testament to see how Christ and the sacraments he instituted were prefigured in the acts of God throughout the history of Israel. But Baptism is the concrete, the reality to which these no less real events pointed forward. We are saved in baptism, Baptism saves us, that is what the Bible says. Why? Because in baptism an appeal is made for a clean conscience, this appeal is made by the Holy Spirit through Christ who died for us. It is into his death and resurrection that we are baptized, forgiveness of sins is given to us there. So we are given his righteousness in exchange for our unrighteousness.