BUDAPEST, Hungary (AP) — Frenchman Esteban Ocon won a chaotic Hungarian Grand Prix on Sunday while an exhausted Lewis Hamilton moved up to second place in the race after Sebastian Vettel's disqualification, increasing his Formula One championship lead over Max Verstappen to eight points heading into the midseason break.

Vettel's penalty fell late Sunday night after officials were unable to take the required fuel sample of 1 liter from his Aston Martin.

“The team was given several opportunities to attempt to remove the required amount of fuel from the tank, however it was only possible to pump 0.3 litres out," governing body FIA said in a statement. “The Stewards determine to apply the standard penalty for technical infringements.”

Aston Martin has appealed the decision.

The ruling bumped Hamilton up to second, Ferrari's Carlos Sainz Jr. to third and Verstappen to ninth — but with an adverse effect for Verstappen as he fell further back overall to eight points, not six.

Hamilton, meanwhile, needed a check from the Mercedes team doctor after the race.

“Had really big dizziness and everything got a bit blurry,” he said. "I have been fighting all year really with the health, staying healthy after what happened at the end of last year (with coronavirus).”

Verstappen was taken out early in the race by Hamilton’s Mercedes teammate Valtteri Bottas in a first-lap crash that caused Bottas and four others to retire.

It was only the 24-year-old Ocon's second podium, following a second-place finish at the Sakhir GP in Bahrain late last year.

“What a moment, feels so good,” Ocon said, patting his heart.

Ocon's teammate Fernando Alonso moved up to fourth.

The crash in the rain was caused by Bottas, who retired as a result.

The race restarted in absurd fashion with only Hamilton on the grid, while others were changing their tires because the track had dried. Hamilton did the same a lap later and came out in last place, a couple of spots behind Verstappen.

“I kept telling them (Mercedes) it’s dry, dry, dry and they said to me ‘stay out,’" Hamilton said. "I don’t understand it ... It’s a mistake from us.”

Mercedes team principal Toto Wolff didn't agree with his star driver.

“It was 100% the right decision and I stand by it,” said Wolff. “I thought that within one lap it couldn’t dry up like it did. You have to take it on the chin — that it was the wrong outcome but the decision was right.”

A clever second tire change by Mercedes for hard tires on Lap 20 outwitted Red Bull and Hamilton moved ahead of Verstappen after he came in for new tires.

With 30 laps to go, the top four was Ocon-Vettel-Sainz Jr.-Hamilton.

To give Hamilton a shot at victory, Mercedes made a third tire change with a little more than 20 laps remaining.

But he had to get ahead of the 40-year-old Alonso first, a driver with 32 wins and 97 podiums, and among the most talented of his generation.

Alonso held off a first attack on Lap 55 and blocked him two more times on Lap 57 with stellar defending on the inside.

Alonso's nous was enough to repel two more attacks.

“He is one of hardest drivers but fair," Hamilton said. “I would say today was a little bit on the limit, but I totally get it and I would do it for my team.”

When Hamilton finally got past there were only five laps left and Sainz Jr. just ahead. He overtook him but by then the front two were too far ahead.

Hamilton's bid for a 100th win resumes on Aug. 29 at the Belgian GP in Spa, where Bottas will start that race with a five-place grid penalty.

Alonso’s brilliant defensive driving helped Ocon secure the victory and they hugged after the race, with Alonso lifting him up in the air.

“We are forming a great team and pushing the team in the right direction," Ocon said.

Hamilton was again loudly jeered by sections of the crowd, as he was after taking pole position on Saturday. He won the British GP two weeks ago despite a 10-second penalty for taking Verstappen out on the first lap.

Heavy rain fell shortly before Sunday's race and the track was soaked. Hamilton got away from pole but Verstappen shot ahead of Bottas into second.

McLaren’s Lando Norris also overtook Bottas, who bumped into the back of him — sending Norris sliding into Verstappen and both off track. Bottas went into a tire wall and took out Verstappen’s teammate Sergio Perez on his way.

Ferrari’s Charles Leclerc was jammed between Aston Martin’s Lance Stroll and McLaren’s Daniel Ricciardo. After a red flag halted the race to allow stewards to clear the wrecked cars, Leclerc, Stroll, Norris and Perez also retired.

When the race restarted, Hamilton was alone on the grid while others were ditching their wet-weather tires to suit the now drying track.

Hamilton had to do the same on the next lap and came out in last place with Verstappen 11th, while Ocon led from Vettel. Nikita Mazepin was the sixth to retire after colliding with 2007 F1 champion Kimi Raikkonen’s Alfa Romeo in the pit lane.

The sinewy and tight 4.4-kilometer (2.7-mile) Hungaroring circuit is arguably the hardest track to overtake on after Monaco.

“I can’t get close to people,” said Hamilton, who fell short of winning the race for a record-extending ninth time.

Ocon was once part of the Mercedes development program and the team's reserve driver two years ago after losing his F1 seat.

___

More AP auto racing: https://apnews.com/hub/auto-racing and https://twitter.com/AP_Sports

Copyright 2021 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.