Sebastian Vettel clinched an important win for Ferrari in Hungary, ahead of the Formula One summer break. The German, who drove most of the race with steering issues, crossed the line 0.9sec ahead of teammate Kimi Raikkonen to secure Ferrari's second one-two of the 2017 F1 season.

Hamilton finished fourth after ceding third place to Valtteri Bottas on the final lap as agreed after his teammate had let him through under team orders earlier in the race to try to attack the Ferraris.

Vettel's fourth win of the season, and first since Monaco in May, extends his championship lead to 14 points over Hamilton. He and Raikkonen stayed one-two after the start, with the Red Bulls of Daniel Ricciardo and Max Verstappen swarming the Mercedes of Bottas and Hamilton.

Verstappen got around the outside of Hamilton with a bold move into Turn 1, but ran wide on the exit and then came under pressure from Ricciardo. He locked up into Turn 2 and ran into Ricciardo, causing damage to the left-hand side of his teammate's Red Bull but escaping unharmed himself.

Ricciardo, who was furious with Verstappen on the radio, dropped down the field and then spun at Turn 4, with fluid leaking from his car, forcing Jolyon Palmer off track to avoid contact. He then pulled over to the side of the track and retired, bringing out the safety car. The stewards deemed Verstappen to be at fault, imposing a 10sec time penalty.

Vettel led comfortably from Raikkonen in the first stint but then started reporting steering concerns. As the Mercedes started closing on the Ferraris, Raikkonen called on his team to ask Vettel, who was struggling to turn in, to cede position but the request was not accepted. Mercedes agreed to Hamilton's similar request with Bottas, on the proviso that the positions were swapped back if Hamilton could not pass Raikkonen.

Once through, Hamilton was soon on Raikkonen's gearbox and was told he had five laps of full power to make a pass. That deadline was extended but Hamilton could not get through and gave up the chase in the closing laps.

Verstappen had run long before his pit stop and led for a short spell before the penalty dropped him back. He rapidly closed on the lead quartet in the final stages and began to attack Bottas, raising doubts over whether Mercedes would be able to swap its cars back. But Hamilton lifted off on the final lap, allowing Bottas through then slotting back in just ahead of Verstappen, as Raikkonen shadowed Vettel to the flag in front.

Fernando Alonso scored McLaren-Honda's best finish of the season with sixth, setting fastest lap right at the end, while his teammate, Stoffel Vandoorne, finished 10th.

Toro Rosso's Carlos Sainz Jr was seventh after a controversial early wheel-banging battle with Alonso, just ahead of Force India's Sergio Perez and Esteban Ocon. Grosjean, who made contact with Nico Hulkenberg and Marcus Ericsson at the start, was forced to pull over and retire his Haas when a wheel nut was cross-threaded at his pit stop.

The unwell Felipe Massa's stand-in, Paul di Resta, spent his first F1 race since 2013 battling with the Saubers, before Williams told him to retire late on due to an oil leak.

After dropping back in his first-corner clash with Grosjean, Hulkenberg looked set to regain ground by running long, only for a problem in his pit stop to drop him back. He was then forced off the road while trying to pass Kevin Magnussen, who was given a 5.0sec penalty for the move, for 11th and retired just as he had caught back up to Magnussen and Daniil Kvyat.