Lewis Hamilton drove a copybook race to win a close battle with Ferrari's Kimi Raikkonen at the Hungarian Grand Prix.
Hamilton had to fend off Raikkonen throughout the race
The Englishman led from start to finish but the McLaren driver was pushed hard throughout the race by the Finn.
But Hamilton stayed cool in the face of intense pressure in the closing laps to extend his championship lead over team-mate Fernando Alonso to seven.
The world champion was fourth after being dropped to sixth on the grid for delaying Hamilton in qualifying.
Alonso spent the last 12 laps right behind the BMW Sauber of Nick Heidfeld, but despite fighting hard was unable to pass the German.
Heidfeld's team-mate Robert Kubica was fifth, with Toyota's Ralf Schumacher, Williams's Nico Rosberg and Renault's Heikki Kovalainen filling the final points positions.
Hamilton looked comfortable in the first stint of the race, quickly building a lead of three seconds and holding it there as he and Raikkonen pushed their cars to the edge.
But after the two men came in for fuel and tyres together on lap 19 Raikkonen began to close in on Hamilton, and by lap 27 the Ferrari was just a second behind the McLaren.
On a track where overtaking is notoriously difficult, though, Raikkonen was never close enough to pass and the Ferrari driver's hopes faded when he came in for his final stop before Hamilton, on lap 46.
It's been an eventful weekend and quite emotional for all the team
Hamilton did not make his stop for another three laps, but was still not able to break free of Raikkonen's challenge.
The Ferrari again closed to less than a second behind Hamilton, but again the McLaren star held his nerve to take his third win of the season.
Hamilton said: "It's been an eventful weekend and quite emotional for all the team.
"With all the drama that has gone on over the weekend, it would have been easy to lose focus. It's been a bit of a downer for the team.
"It was one of the hardest races I've ever had. Just to get the points is so important for me and for the morale of the team. We've shown that we can beat anyone.
"We made a really good step forward with a great package but we still weren't sure whether we'd be ahead of the Ferraris. You could see in the race they had great pace.
"Kimi was on my tail for quite a long time, he drove a great race. But I know how to win races."
Alonso spent all of his race trying to fight through traffic
Raikkonen fell to 20 points behind Hamilton with just 60 still available in the remaining six Grands Prix.
But he said he had not given up hope of winning the title.
"There are many races to go," Raikkonen said. "One bad race and everything can change.
"It was kind of a boring race, just waiting behind (Hamilton), waiting for something to happen.
"When two cars are very close the guy in front has to make a big mistake for you to pass."
Alonso's actions in qualifying have increased the tensions within McLaren, with Hamilton saying after the race: "He doesn't seem to have been speaking to me since yesterday, so I don't know if he has a problem."
Alonso spent much of the race stuck behind the Toyota of Ralf Schumacher.
The Spaniard finished the first lap in eighth place after being blocked by Williams's Nico Rosberg as he attempted to make up places at the start, and then sliding wide at the last corner.
Hamilton said it was probably his toughest win
Alonso passed Red Bull's Mark Webber and Kubica on consecutive laps to move up to sixth by lap three.
But, his car's aerodynamics hampered by following the Toyota, Alonso could not get past the German before their first pit stops for tyres and fuel on lap 17 of 70.
Alonso was given a heavy fuel load, the plan being for him to do a long middle stint and leapfrog some of the slower cars in front of him during the first pit stops.
Even so, he quickly closed in on Schumacher, but again the McLaren was unable to pass - and only got a clear track when the Toyota came in for its final stop on lap 48.
Alonso pitted on the next lap, and emerged comfortably ahead of Schumacher in sixth place.
Suddenly, though, he was in contention for a podium place, when the cars of Heidfeld, Kubica and Rosberg came in for their third stops - one more than used by McLaren and Ferrari.
Alonso leapfrogged Kubica and Rosberg in the pits, and Heidfeld emerged not far in front of the Spaniard, a gap Alonso quickly reduced to almost nothing.
Alonso tried everything to pass, but Heidfeld managed to hang on.
"It's a lost opportunity because I think this weekend I was faster [than Hamilton]," Alonso said.
"I got pole and today when I was in clean air I was very fast, so I think I could have won, but it was not to be. In three weeks there's another race and I'll try again."
Hungarian Grand Prix result after 70 laps of Hungaroring:
1. Lewis Hamilton (GB) McLaren-Mercedes one hour 35 minutes 52.991 seconds
2. Kimi Raikkonen (Fin) Ferrari +0.715 secs
3. Nick Heidfeld (Ger) BMW Sauber +43.129
4. Fernando Alonso (Spa) McLaren-Mercedes +44.858
5. Robert Kubica (Pol) BMW Sauber +47.616
6. Ralf Schumacher (Ger) Toyota +50.669
7. Nico Rosberg (Ger) Williams-Toyota +59.139
8. Heikki Kovalainen (Fin) Renault +1:08.104
9. Mark Webber (Aus) Red Bull-Renault +1:16.331
10. Jarno Trulli (Ita) Toyota one lap behind
11. David Coulthard (GB) Red Bull-Renault 1 lap
12. Giancarlo Fisichella (Ita) Renault 1 lap
13. Felipe Massa (Brz) Ferrari 1 lap
14. Alexander Wurz (Aut) Williams-Toyota 1 lap
15. Takuma Sato (Jpn) Super Aguri-Honda 1 lap
16. Sebastian Vettel (Ger) Toro Rosso-Ferrari 1 lap
17. Adrian Sutil (Ger) Spyker-Ferrari 2 laps
18. Rubens Barrichello (Brz) Honda 2 laps
R Vitantonio Liuzzi (Ita) Toro Rosso-Ferrari 52 laps completed R Anthony Davidson (GB) Super Aguri-Honda 51 laps
R Jenson Button (GB) Honda 45 laps
R Sakon Yamamoto (Jpn) Spyker-Ferrari 4 laps
Key: R = retired
Fastest Lap: Kimi Raikkonen, 1:20.047, lap 70.