Of the original Spanish colonies that declared independence, many ended up being broken up into smaller states (Federal Republic of Central America, Gran Colombia, United Provinces of the River Plate). Why did Mexico not succumb to the same internal conflicts?
Mexico did internally split: Texas revolted and went its own way. Remember, it was its own country for about 10 years before joining the US.
Besides that, there were other internal splits. The Republic of the Rio Grande was a short-lived attempt at establishing an independent state in northern Mexico. There was a Mayan state in the south of Mexico that was de facto independent for the second half of the 1800s, and was not fully integrated into Mexico until the 1940s.
The Republic of the Yucatan existed as an independent country in the mid-19th century. They voluntarily rejoined Mexico in the aftermath of the Caste War, but there is still a strong independent streak in Yucatan, and I would not be surprised if the Yucatan splits off again (or tries to) in my lifetime.
Peru, Puerto Rico, Cuba, the Dominican republic, the Philippines, Jamaica, Equatorial Guinea, Guam, Guatemala, Honduras, Trinidad and Tobago, Paraguay, Uruguay and Chile have never splintered since declaring or being granted independence from Spain. this is not an exhaustive list.
Mexico isn't alone.