Red Bull's Sebastian Vettel held off a stern challenge from McLaren's Lewis Hamilton to win a thrilling Spanish Grand Prix.

It was Vettel's fourth win in five races, but the huge pace advantage Red Bull showed in qualifying vanished and Hamilton pressured him throughout.

Hamilton's team-mate Jenson Button made one fewer stop in taking third.

Ferrari's Fernando Alonso led the first 18 laps but faded to fifth behind Red Bull's Mark Webber.

"That was an immense fight," said BBC F1 co-commentator David Coulthard and Vettel's pleasure at holding off Hamilton's challenge was clear from the world champion's thrilled response to his team's congratulations on the slowing down lap. "Yabba-dabba-dee," the 23-year-old screamed.

The world champion acknowledged he had been pushed hard until the end.

"McLaren were very strong, Lewis in particular," he said.

"The last few laps I felt like China, with my tyres falling away. He [Hamilton] was always getting in the DRS zone but in the last few laps I got a good run in the last sector to make it stick."

While frustrated at finishing just 0.6 seconds behind Vettel, Hamilton was hugely encouraged by McLaren's pace compared to the Red Bulls.

"I wasn't expecting to be so quick today, as the race went on we had some serious pace, but he [Vettel] was massively quick in the high speed corners," said Hamilton.

BBC F1 commentator Martin Brundle added: "That will be a warning sign to Red Bull."

Red Bull had been expected to dominate the race after qualifying nearly a second clear of their rivals, with Webber on pole ahead of Vettel.

The thrills began as soon as the lights went out at the start of the race, when Alonso catapulted away from fourth place on the grid to lead into the first corner.

Alonso's start was one of the best seen for a long time as he shrugged off the disadvantage of starting on the dirty, more slippery side of the grid to power off the line.

He tracked the Red Bulls down to the first corner and dived down the inside to claim the lead, drawing huge cheers from the 80,000 crowd of his adoring compatriots.

"That was fantastic," said BBC F1 co-commentator David Coulthard. "The motivation he had to lead this grand prix."

Ultimately, it did not help Alonso but, while holding off a train comprising Vettel, Webber and Hamilton, he was able to lead superbly through the first pit stops until the key turning point came on lap 18 of the 66-lap race.

That was when Vettel came in for his second stop, and he made up enough time on his out lap to jump Alonso, who pitted on the next lap in a vain attempt to hold on to the lead.

Hamilton and McLaren did not make that mistake, and were able to keep the pressure on the Red Bull.

They kept running until lap 23, coming out just over four seconds behind Vettel.

They battled intensely for the rest of the race, Hamilton edging ever closer to Vettel before both their third and final pit stops, closing to within 1.2 seconds each time, only to lose a second at the stops on both occasions.

They spent the final 10 laps nose to tail and although Vettel's pace was compromised at times throughout the race by his Kers power-boost system working only intermittently, it returned for the final laps of the race.

Hamilton had a look at passing him a couple of times but Vettel was able to hold on.

Button finished more than 30 seconds behind the lead pair after choosing a three-stop strategy compared to the four of the other leading runners.

"We never planned to do anything but a three-stop strategy as I thought doing two stints on a prime tyres was no good," said Button.

"It would have been interesting to see what would happened if I didn't have a bad first lap, but all in all it was a good day and good to get a podium."

Spanish Grand Prix result:
1. Sebastian Vettel (Ger) Red Bull-Renault
2. Lewis Hamilton (GB) McLaren-Mercedes
3. Jenson Button (GB) McLaren-Mercedes
4. Mark Webber (Aus) Red Bull-Renault
5. Fernando Alonso (Spa) Ferrari
6. Michael Schumacher (Ger) Mercedes GP
7. Nico Rosberg (Ger) Mercedes GP
8. Nick Heidfeld (Ger) Renault
9. Sergio Perez (Mex) Sauber
10. Kamui Kobayashi (Jpn) Sauber

Championship standings:
1. Sebastian Vettel (Ger) Red Bull-Renault 118 pts
2. Lewis Hamilton (GB) McLaren-Mercedes 77
3. Mark Webber (Aus) Red Bull-Renault 67
4. Jenson Button (GB) McLaren-Mercedes 61
5. Fernando Alonso (Spa) Ferrari 51
6. Nico Rosberg (Ger) Mercedes GP 26
7. Nick Heidfeld (Ger) Renault 25
8. Felipe Massa (Brz) Ferrari 24
9. Vitaly Petrov (Rus) Renault 21
10. Michael Schumacher (Ger) Mercedes GP 14

Constructors' championship:
1. Red Bull-Renault 185 pts
2. McLaren-Mercedes 138
3. Ferrari 75
4. Renault 46
5. Mercedes GP 40

BBC Sport