World championship leader Nico Rosberg has seized pole position in a rain-delayed qualifying session for Monday's Hungarian Formula One Grand Prix.

His teammate and title rival Lewis Hamilton was tellingly hindered by yellow flags at the critical point of the stop-start day and had to settle for second.

Australian Daniel Ricciardo claimed third spot for Red Bull.

Rosberg lapped the 4.3-km Hungaroring circuit in one minute 19.965 seconds, 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 the result.

"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. I'm not really too disappointed."

The pole was the 26th of Rosberg's career and his fourth of the season.

It was also Mercedes' 46th in the past 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 said he'd lifted off the throttle in that section of the track.

Rosberg, who agreed a two-year extension to his contract with Mercedes on Friday, leads Hamilton by one point in the championship.

Ricciardo's second row result came with former champions Red Bull hoping to challenge Mercedes for the win. His teammate Max Verstappen claimed fourth.

Sebastian Vettel, winner in Hungary last year, finished fifth.

Torrential rain in the build-up to qualifying forced the start to be delayed 20 minutes.

The 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.