No. Costa Rica is an independent, sovereign country in Central America—never part of Mexico.
Bordered by Nicaragua (north) and Panama (south), with Pacific coastline to the west and Caribbean to the east. It gained independence from Spain in 1821 as part of the Federal Republic of Central America, becoming fully sovereign in 1838.
Shared language (Spanish), colonial history, and regional proximity sometimes cause confusion. But Costa Rica has maintained distinct political institutions, currency (colón), and national identity for nearly two centuries.