Jorge Lorenzo captured his sixth pole position of the MotoGP season with a last-gasp, record effort in qualifying at Motegi.