Lewis Hamilton only fourth as Sebastian Vettel takes pole in Hungary
Ferrari's Sebastian Vettel took pole position for the Hungarian Grand Prix heading a Ferrari one-two as title rival Lewis Hamilton struggled in fourth.
Hamilton, who trails Vettel by one point in the world championship, complained consistently of tyre problems in his Mercedes and had a messy session.
Vettel was 0.254 seconds quicker than the fastest Mercedes of Valtteri Bottas, with team-mate Kimi Raikkonen second.
Scot Paul di Resta qualified an excellent 19th after being drafted in as a last-minute stand-in for Williams' Felipe Massa.
Why have Mercedes fallen back?
Mercedes have been struggling for pace all weekend and were a second or so off the Ferraris in final practice.
Without his problems, Hamilton may have had the pace to be on the front row, but suspicion is that the long-wheelbase Mercedes is simply not as well suited to the tight and twisty Hungaroring as other, faster tracks.
Mercedes made progress in qualifying, and Hamilton actually set the fastest time in the second part, albeit doing two runs rather than only one like Ferrari.
- Lewis Hamilton bids to keep Hungary run going
- Listen: Hungarian Grand Prix Preview
- Predict the Hungarian GP podium
Hamilton had complained of a tyre vibration on his first run in second qualifying and the same happened on both his runs in the top 10 shoot-out.
Hamilton ran wide at the fast, blind, uphill Turn Four on his first run and aborted it, leaving him just one lap to try to beat Vettel's scintillating initial time of one minute 16.276.
Hamilton again complained of tyre vibrations when he went out for his final run but was only 0.1secs down after the first two sectors, only to lose another 0.3secs in the final sector.
Vettel was on course to beat his time on his second run in Q3 but lost out in the final sector, and was 0.002secs slower. He believed he had over-worked the tyres in the first part of the lap.
Red Bull had looked competitive on Friday and Daniel Ricciardo had hopes of qualifying close to the front.
But an engine hydraulics failure early in final practice robbed him of running and he was not happy with the car in qualifying. He qualified sixth, just behind team-mate Max Verstappen.
Sterling job by di Resta
Di Resta was highly impressive in very difficult circumstances, the first time he had driven in F1 since he left the sport at the end of 2013.
His only experience of the hybrid-engined cars introduced in 2014 is a few laps in a Williams and he had never driven a 2017 new era car before. The 31-year-old was 0.766secs slower than team-mate Lance Stroll.
Massa withdrew after feeling unwell and dizzy. He had suffered the problem on Friday and went to hospital, but was released and cleared to drive on Saturday morning by F1's doctors.
But the problem recurred in final practice and he decided he had to pull out of the race.
Di Resta said: "It has been quite a long time. To get out there and drive a proper racing car again and just enjoy it, I was anxious, nervous going into it doubting your ability for whatever reasons. I have gone out and done what I could. It is going to be a long day tomorrow.
"Last night it was probably more sure I was going to drive. But then he did P3. [Going straight into qualifying] was like jumping off a cliff and fighting for survival."
McLaren looking half decent
Jolyon Palmer qualified 11th for Renault, but was 0.8secs slower than team-mate Nico Hulkenberg in second qualifying, after which the Englishman was knocked out.
Hulkenberg qualified seventh but will take a five-place grid penalty for an unauthorised gearbox change.
That promotes the McLarens of Fernando Alonso and Stoffel Vandoorne to seventh and eighth on the grid.
On his 36th birthday, the Spaniard was 0.345secs quicker than his rookie team-mate.
What they said
Vettel, who saw his lead cut by 19 points by Hamilton after he finished seventh following a late puncture in the last race at Silverstone, said: "The last race wasn't great for us, but it doesn't matter now.
"I am really happy with where we are as a team. It is great to get the result on Saturday but the main task comes tomorrow."
"I got the car in quite a good spot in Q2 and was hoping to at least start there in Q3 and build on it," said Hamilton. "But that's the way it goes and at least I am on the second row. I don't think we could have matched the Ferraris even if I did a great lap."
Bottas said: "They have been quick all weekend and we knew it should be close and they would be tough to beat. They got everything right today and we still have work to do on circuits like this.
"This weekend we can see we are not performing as we would like."