Red Bull's Max Verstappen did just enough to beat McLaren driver Oscar Piastri to pole around Jeddah Corniche Circuit.