Since a change in legislation in 2012, you need to have a job offer or work contract from a company registered in Mexico to apply for a work permit. The company has to apply for the work permit with the INM and you can stay in Mexico on a tourist visa until you are cited to collect your visa in the Mexican consulate of your home country. You then have to leave Mexico and pass an interview at the consulate abroad, after which you get your work permit.
For the application, the company has to submit various documents, e.g. a proof of tax payments, a list of employees and their nationalities, the personal identification of a designated representative. Furthermore, a copy of your passport or other ID has to be submitted.
Once the application is accepted, the INM will process the case and make a decision within 20 days. If the application is approved by the INM you will have to go to your Mexican consulate and pass an interview to collect your work permit.
After your arrival in Mexico you and your family members must register at the INM within 30 days. Your spouse and children will normally get dependant visas but they are not automatically granted a work permit. If your spouse wants to work in Mexico he or she will have to apply for their own work permit separately.
Can you convert your visitor status to a work status in Mexico?
Technically, no. Foreigners with a visitor status can have a company they want to work for apply for a Mexican work permit with the National Institute of Migration (Instituto Nacional de Migración). While the application is processed, visitors can stay in Mexico until they are cited by said Institute to collect the permit at the consulate of their home country. They have to leave Mexico and collect the permit. Only after that can you apply for a residence visa.