You'll go through immigration in MTY. If you're flying with the same airline or your bag is tagged to your final destination, you'll clear immigration on the final destination. Your bags will be have orange tags indicating you're an international traveler. When you get into Mexico City's baggage hall, there are some customs agents, sometimes they'll see the tags and could or could not check them.
If you are traveling with 2 airlines with no interline agreement, then you would have to check-in in MTY
as well, so you'll clear customs there.
Have a nice trip.
[Edited 2003-11-22 08:29:39]