Baptism is a rite that states symbolically that one is burying the old, sinful "man", then rising again as a new person in Christ.
"We were therefore buried with him through baptism into death in order that, just as Christ was raised from the dead through the glory of the Father, we too may live a new life." Romans 6:4 It is not necessary for salvation.
Ephesians 2:8-9, "For it is by grace you have been saved, through faith—and this is not from yourselves, it is the gift of God— not by works, so that no one can boast."
In this case, baptism is a "work"; it doesn't not save.