You are right that in general having the same cardinality is not enough (e.g. $[0,1]$ vs $(0,1)$ with Euclidean topology). However in the case of finite complement topology it is enough.
For that consider any bijection $f:X\to Y$ with finite complement topology on both sides. It is continuous because the preimage of a finite set is finite. It is closed because the image of a finite set is finite. These two properties are enough to ensure that $f$ is a homeomorphism.