(edited slightly) A one to one continuous map between connected two compact $n$-dimensional manifolds without boundary having equal numbers of components must be onto(, and in fact a homeomorphism)homeomorphism.
The image of any connected component must be connected, open (by invariance of domain), and closed (by compactness).
You can replace the hypothesis "connected" by "having the same number of components", and therefore must be a component.

