Lewis Hamilton claimed his first pole position as a Ferrari driver in qualifying for the Mexican Grand Prix.