When did Mexico become part of North America?

Mexico became part of North America in 1821 when it declared its independence from Spain.