Mexico is considered "contiguous territory" with the United States and therefore, in addition to having a ticket that exits the USA you MUST also have either a residence permit for Mexico or else a ticket that exits Mexico to a point outside "contiguous territory" within 90 days of your entrance to the USA in order to be eligible to use the VWP. Alternatively, you should apply for a B1/B2 US visa prior to your journey.
If you are entering at a land border, this may not be immediately evident to the CBP officer and you may be granted entry without any issues, but if traveling by air it should be a flag from your APIS data and could potentially cause issues upto and including denied entry, expedited removal, permanent ineligibility for the VWP and a 5-year entry ban from the USA.