Yes. When you land in DF, you will be required to clear immigration and customs with all of your luggage, then re-check any checked bags, and re-clear security. I have done this before, and my girlfriend just did it last week (LHR -> MEX -> GDL).
When things are running smoothly, it shouldn't take more than an hour to do all of that. But if you have checked luggage, and there is a delay in unloading the luggage, for instance, or it's a particularly busy time of day, it make take longer.
It's always better to plan on the side of too much time than too little, IMO. I would want at least 2 hours between flights, and would feel more comfortable with 3. More than 4 and you'll just be killing time (although I have learned not to mind that, if I carry a good book).
Also keep in mind that MEX is a large airport, and depending on where your arrival and departure gates are located, you may spend as much as 20-30 minutes just walking between gates.