Baptism is necessary for salvation, but is not the only thing necessary.

16 He who believes and is baptized will be saved; but he who does not believe will be condemned.

– Mark 16:16

38 Then Peter said to them, “Repent, and let every one of you be baptized in the name of Jesus Christ for the remission of sins; and you shall receive the gift of the Holy Spirit.

–  Acts 2:38, NKJV

21 There is also an antitype which now saves us—baptism (not the removal of the filth of the flesh, but the answer of a good conscience toward God), through the resurrection of Jesus Christ,

–  1 Pet. 3:21, NKJV