Ferrari's Sebastian Vettel withstood a late charge from Lewis Hamilton to win a captivating Bahrain Grand Prix and open up a seven-point championship lead after three races of the 2017 Formula One season.

Having been slapped with a five-second time penalty for driving unnecessarily slowly in the pit lane entrance, the Mercedes favourite was unable to chase down his title rival and eventually finished 6.660 seconds behind.

Starting behind the Silver Arrows on the second row of the grid, Vettel, who claimed victory on the opening weekend of the season in Melbourne before battling to second place in Shanghai last time out, jumped Hamilton at the first corner and Ferrari made the bold decision to pit him after only 10 laps to fit fresh tyres and go for the undercut.

Young Max Verstappen followed suit but quickly saw his afternoon ended by brake failure that led to him crashing into the barrier at turn four.

With Valtteri Bottas leading after securing the first pole of his five-year F1 career, the safety car was deployed on lap 13 after a collision between Carlos Sainz and rookie Lance Stroll. That caused something of a pit build-up and Hamilton lost a place to Daniel Ricciardo before being punished for impeding the Red Bull driver.

Bottas also came out behind Vettel and continued to lose ground on the four-time world champion. That led to a fearful Mercedes instructing the Finn to let quicker teammate Hamilton pass, which he did without complaint.

Vettel pitted again on lap 34, while Hamilton, who had been steadily eating away at that advantage, later served his penalty after being fitted with soft tyres. He re-emerged in third position and overtook Bottas - who was again asked to let him through - with 10 laps remaining to set up a tense climax. Despite his best efforts, however, the German held on to claim his second win of the year.

"A really great day," Vettel said on the podium, as per Sky Sports. "It was a team effort today. Right from the start I could feel we were quick. Valtteri didn't make any mistakes. We went for the undercut and it worked fantastically. I was surprised I came out ahead of all of them as I thought we may have lost the advantage with the safety car. Lewis was a bit of a threat at the end. But the car was a dream today."

Sebastian Vettel
Sebastian Vettel celebrates his victory at Bahrain's International Circuit Reuters

After taking responsibility for that slow entry into the pits, Hamilton said: "Congratulations to Seb and thank you for Valtteri for being a gentleman out there. I tried my hardest to catch up but it was a long way to go. I gave it everything I could. Ferrari did a great job. We will regather as a team and come back fighting. Losing points for the team is definitely painful but it is what it is."

Bottas crossed the line in third, while Kimi Raikkonen took fourth and Ricciardo claimed fifth ahead of Felipe Massa. Force India's Sergio Perez drove brilliantly to rise from P18 to P7 and the top 10 was rounded off by Romain Grosjean, Nico Hulkenberg and Esteban Ocon.

On another day to forget for beleaguered McLaren-Honda, Stoffel Vandoorne was unable to even start the race and Fernando Alonso, who will be replaced by Jenson Button for May's Monaco Grand Prix as he races in the Indianapolis 500, recorded his third successive DNF (did not finish). That latest retirement came just two laps from the end.

Incensed by his faltering power unit after losing out to Jolyon Palmer and Daniil Kvyat on the long straight, the understandably frustrated Spaniard lamented that he had "never raced with less power" in his life.