Lewis Hamilton was handed a 10-second penalty for gaining a lasting advantage by leaving the track following a close-quarters battle with Max Verstappen at the Mexico City Grand Prix.