Budapest: World championship leader Nico Rosberg seized pole position in a rain-delayed, stop-start qualifying session for Sunday's Hungarian Formula One Grand Prix after team mate and title rival Lewis Hamilton was hindered by yellow flags.
Rosberg lapped the 4.3-km Hungaroring in one minute 19.965 seconds on Saturday, beating Hamilton by 0.143 seconds.
The Briton, ahead of Rosberg on the road as the Mercedes pair began their final runs, had to slow down as yellow flags waved for Fernando Alonso's spinning McLaren, forcing him to abort his lap.
The reigning champion had been significantly quicker and on course for pole up to that point.
Hamilton, though, was relaxed about being second on the grid. "I don't know how much Nico was up but I got the fastest first sector," he said. "Bit unfortunate with Fernando but these things happen so I'm not really too disappointed."
The pole was the 26th of Rosberg's career and his fourth of the season. It was also the Mercedes team's 46th pole in the last 49 races, with the German outfit starting all but one race this year from the front.
There were doubts about whether Rosberg would be allowed to keep pole after onboard replays showed him also encountering yellow flags but the 31-year-old driver said he had lifted off the throttle in that section of the track.
Rosberg, who agreed a two-year extension to his contract with Mercedes on Thursday, leads Hamilton by one point in the championship.
Daniel Ricciardo was third for Red Bull on a weekend when the former champions hope to challenge Mercedes for the win, with his team mate Max Verstappen fourth.
Sebastian Vettel, winner in Hungary last year, was the sole Ferrari driver in the top 10 in fifth. Team mate Kimi Raikkonen fell casualty to the rapidly shuffling order in changing conditions and was knocked out in the second phase of qualifying. He starts 14th.
McLaren had their best qualifying result since renewing their engine partnership with Honda at the start of last year with Fernando Alonso and Jenson Button, who both had their first race wins in Hungary, in seventh and eighth.
Force India's Nico Hulkenberg and Williams Valtteri Bottas rounded out the top 10.
A torrential rain shower in the build-up to qualifying forced the start of the session to be delayed by 20 minutes.
The opening 18-minute session was then interrupted by four more red flags, first as the rain returned and then as several drivers, including Williams's Felipe Massa, crashed out.
It eventually ended almost an hour later when a crash for Manor's Rio Haryanto brought out the final red flag.