Marc Marquez claimed pole position at the German Grand Prix for the fifth year in succession, but acknowledged the difficulty he faced in mastering wet conditions.
Repsol Honda rider Marquez has won from pole in each of his previous four years in the premier class and took top spot yet again on Saturday, pipping Pramac Ducati's Danilo Petrucci - who had set the pace in Q1.
On a track saturated by a downpour in the final stages of free practice, Marquez edged Petrucci by 0.160 seconds with a time of one minute and 27.302 secs at Sachsenring.
"It was quite difficult to understand when to push. I tried to be calm at the start," Marquez said.
"I was trying to take care and improve the lap time step-by-step. Then at the end I really pushed. I'm happy because it's always very tricky in wet conditions."
Marquez's team-mate Dani Pedrosa rounded off the front row, with Cal Crutchlow (LCR Honda), Jonas Folger (Movistar Yamaha Tech3) and Jorge Lorenzo (Ducati) on the second row.
The Yamahas of Valentino Rossi and Maverick Vinales struggled, finishing ninth and 11th respectively, the latter surviving early contact with Marquez at turn 2.
Championship leader Andrea Dovizioso sandwiches the pair, the Ducati rider only good enough for 10th.
1. Marc Marquez (Repsol Honda) 1:27.302
2. Danilo Petrucci (Pramac) 1:27.462
3. Dani Pedrosa (Repsol Honda) 1:27.949
4. Cal Crutchlow (LCR Honda) 1:28.089
5. Jonas Folger (Monster Yamaha Tech 3) 1:28.210
6. Jorge Lorenzo (Ducati) 1:28.383
7. Pol Espargaro (KPM) 1:28.402
8. Aleix Espargaro (Aprilia) 1:28.526
9. Valentino Rossi (Yamaha) 1:28.669
10. Andrea Dovizioso (Ducati) 1:28.703