Max Verstappen edged out Red Bull team-mate Sergio Perez to claim pole position at the Japanese Grand Prix.