Ferrari's Sebastian Vettel was quickest in qualifying at the Hungaroring with championship rival Lewis Hamilton only fourth. Paul di Resta replaced an unwell Felipe Massa for Williams.
Germany's Sebastian Vettel received the perfect boost for the Formula One title race after seizing pole position in Hungary.
The Ferrari driver had suffered a wobble in the last four races to allow Mercedes rival Lewis Hamilton to close the gap in the standings to just one point.
But Vettel powered back to form in Budapest on Saturday and will hope to convert his showing into maximum points in Sunday's race.
Hamilton, winner of the last race on home tarmac in Britain, was left scratching his head after only managing fourth spot on the grid. He missed the chance to equal Michael Schumacher's record tally of 68 pole positions. Vettel's Ferrari teammate Kimi Raikkonen was second quickest in qualifying with Mercedes driver Valtteri Bottas third.
It was Ferrari's first front row shutout at the Hungarian Grand Prix since 2004 and the team seemed generally surprised by how much quicker they were than Mercedes.
"Nothing changed overnight. The last race wasn't great for us but that doesn't matter now. I'm very happy where we are as a team," Vettel said.
"The main task comes tomorrow. Nothing has been won today."
Hamilton though has won in Hungary from fourth position on the grid in the past, managing the feat in 2009. But he was not sounding hopeful.
"You can't overtake here, it will most likely be a train unless we do something with strategy," he said.
Erstwhile Formula One driver Paul di Resta replaced an unwell Felipe Massa for Williams. He was knocked out in Q1 and was 19th fastest, but that was just seven tenths of a second off teammate Lance Stroll's time, despite never having set foot in a 2017 car.