Lando Norris secured pole position at the Mexico City Grand Prix, fending off the Ferrari pair of Charles Leclerc and Lewis Hamilton.