Formula One leader Lewis Hamilton made the most of the changeable conditions to seize pole position for the Belgian Grand Prix ahead of Ferrari title rival Sebastian Vettel on Saturday.
French driver Esteban Ocon qualified a remarkable third for Force India for the team's first race under new ownership, with Mexican team mate Sergio Perez fourth after a rain-hit final session.
The pole was Hamilton's fifth at Spa, a record, and 78th of his F1 career but it was touch and go on a drying track with the clock ticking.
Slipping wide and across the grass runoff, the champion left himself just one final shot at a flying lap before the time ran out and he nailed it.
"It was one of the toughest qualifying sessions I can remember," said Hamilton, who won from pole in Belgium last season and is 24 points clear of fellow-four times champion Vettel with nine races remaining.
"We were very close, I was hopeful, Ferrari were very quick on the straights, then the rain came and I can't stress how difficult it was.
"The track looked dry in some places, but it was actually wet. It was so hard, I went off twice, but so glad I managed to keep it together. Everyone is on the edge of their seats."
Sunday's race looked set up to be a battle between the two great rivals, with Vettel possibly having the faster car, after a qualifying that shook up the grid beyond the two championship contenders.
Vettel's team mate Kimi Raikkonen, a four-times winner at Spa, starts only sixth while Mercedes' Valtteri Bottas will line up at the back of the field due to accumulated engine grid penalties.
The Red Bulls of Max Verstappen and Daniel Ricciardo qualified seventh and eighth.
"It got drier at the end, we had done our laps at the beginning thinking it (the conditions) was going to get worse so we were just unlucky I guess," said Ricciardo.
Taking advantage of the drying track, surprised Frenchman Romain Grosjean put his Haas in fifth place behind the Force India pair.
Vettel and Raikkonen had both earlier shattered the Spa circuit record, banging in laps of one minute 41.501 and 1:41.627 respectively to better the 1:41.770 set by a Porsche 919 world endurance car in April.
Hamilton's pole time was a comparatively slow 1:58.179, with Vettel managing 1:58.905.
"It was a bit chaotic and not great from a management point of view," Vettel said. "I don't feel we put everything together in the last lap, we ran out of battery.
"It wasn't a nice ending to a great qualifying up to that point. It's great fun but obviously not very rewarding when you know you could have done a bit better."