World champion Sebastian Vettel took his first victory of 2012 in a close battle with Lotus's Kimi Raikkonen at the Bahrain Grand Prix.
The Red Bull driver built an early lead from pole but was caught by the Finn, who started 11th, after half distance.
Vettel then pulled away after the final pit stops, despite Raikkonen's attempts to close him down.
Lotus's Romain Grosjean was third, with McLaren's Lewis Hamilton finishing eighth and Jenson Button retiring.
Force India's Paul di Resta, doing a two-stop strategy in contrast to the three employed by the rest of the main contenders, drove an excellent, studied race to take sixth place.
The Scot was running fifth going into the final 10 laps but was helpless to defend from Mercedes driver Nico Rosberg, who was on fresher tyres in the closing laps.
Di Resta seemed poised to lose a further place to Button, but the Briton's McLaren suffered a puncture with three laps to go and dropped out of the points, before retiring on the penultimate lap with a broken exhaust.
The Scot also just managed to hold off a challenge from Ferrari's Fernando Alonso in the closing laps.
Rosberg was investigated for possible dangerous driving in defending from both Hamilton and Alonso earlier in the race, but was cleared of any wrongdoing by the stewards.
Ferrari's Felipe Massa produced his strongest race of the season to take ninth, ahead of Mercedes driver Michael Schumacher, who battled up from 22nd on the grid.
The result means Vettel takes the championship lead, after starting the race in fifth place, while Hamilton has slipped down to second, ahead of Vettel's team-mate Mark Webber - who finished fourth in Bahrain - Button and Alonso.
Bahrain's Sakhir circuit is notorious for producing uninteresting races, but this was an exception, with a tense battle for the lead and several wheel-to-wheel scraps down the field.
Vettel stormed into the lead from pole, building a five-second lead after eight laps in the sort of performance that won him 11 races on his way to the title last year.
"It was an incredible race," said the German. "We had a very good start, which was crucial. I was able to pull away from the pack which turned out to be a good advantage because we always had to go on used tyres.
"Kimi was quick, and so was Romain. It was a difficult race. Once he was close, I thought he would have more than one shot, but in the end I was able to pull out of a gap."
Raikkonen was judging his rise from 11th place on the grid to perfection, his low qualifying position a tactical ploy to ensure he had more sets of new tyres to use in a race that all teams expected to be dominated by tyre management in the high temperatures.
After 10 laps, Raikkonen was up to third place behind Vettel and Grosjean and he continued to close on the leading pair after they had all made their first pit stops.
He passed Grosjean on lap 24, and then began to close on Vettel, who he caught by lap 33.
But the Finn could not pass the Red Bull and after they stopped together for the final time on lap 39, Vettel eased away and Raikkonen could not hold him.
"It's always easy to say if afterwards, but in the end we were not fast enough," he said. "I had one chance to pass Sebastian but I chose the wrong side. I didn't get another chance. We gave ourselves a chance, but we didn't do it."
The race provided a fascinating spectacle throughout, but it did little to distract from the main focus of the weekend - the wisdom or otherwise of deciding to hold the race in Bahrain in the midst of ongoing civil unrest.