Ludwig Augustinsson opened the scoring with a volley to launch Sweden into first position in Group F.
Their goal put Mexico in a very vulnerable position as Germany only need to beat South Korea in the other fixture to send the Central American side home.
They tried to get back into their match but were handed a further blow when Sweden doubled their lead in the 62nd minute.
Hector Moreno fouled Marcus Berg in the box to hand the European side a penalty, which Granqvist had no trouble sending past opposing goalkeeper Guillermo Ochoa to give Sweden a 2-0 lead.
It was the second spot-kick which Granqvist has scored in this summer's tournament and it could prove crucial.