The Mercedes driver's 55th career win was hard-fought and tense, with Ferrari's Vettel seizing the lead from Hamilton at the start and in the hunt all the way as the tyre strategies played out.
Hamilton was delighted with his performance.
In a ding-dong contest, first Vettel forced Hamilton wide at Turn One after he emerged from his second stop next to the Mercedes.
Felipe Massa collided with both McLaren cars.
After a mid-race safety auto eroded Buemi's early lead, di Grassi charged onto the Swiss driver's tail in the closing laps, eventually finishing just 0.320sec adrift. Vettel took on the soft tyre, the quickest, but less durable of the three compounds available here this weekend.
"He came out of the pits and I was a bit surprised that it was so close", Vettel added.
"Lewis and myself both picked up some wheel-spin straight away", said Vettel. This put Valtteri Bottas into the lead, though he was yet to make a pit stop.
Green Machine is back, Deere posts a big 1Q and ups outlook
Looking ahead, DE forecast Q3 revenues to rise 18% to about $6.92 billion, well ahead of Wall Street's $6.24 billion outlook. Shares of Deere traded up 5.5% at $118.81 in the premarket Friday morning, a new 52-week high if it holds after the bell.
But on lap 25 Vettel made his move.
The next F1 race is the Monaco Grand Prix on May 28.
The virtual safety auto was deployed when Alonso's team mate Stoffel Vandoorne broke his car's suspension in a collision with Massa on lap 34. As a result, Vettel came out of the pit lane side-by-side with Hamilton instead of eight seconds ahead. Bottas clipped the rear-right wheel of Raikkonen as he went down the outside of the Mercedes at the first corner and the Ferrari bounced into the Dutchman.
"Having a battle and a fight with another team, it's so much more enjoyable", said Hamilton, whose new team mate Valtteri Bottas won in Russian Federation last month but retired in Barcelona with an engine failure.
Four-time title victor Vettel admitted he and Hamilton were "not best friends" but that he had "nothing to moan about" in the manner of defeat.
In the 2017 Drivers' Championship, Vettel maintains the lead spot with 104 points.
The Australian said: "I'm happy to be back on the podium today, it's the first one of the season for me which is nice but actually the race was quite a lonely one". "I pulled the clutch back in and then I could gain on him".
EPL wins for Arsenal and Manchester City
"We won 71 points last season and finished second". "I don't think there are a lot of players like him and a player like this who can be the difference during the game, it's rare".
Stewards investigated the incident but ruled that no driver was wholly to blame.
Hamilton was not about to give up, however, and after gaining once more on the Ferrari he seized his opportunity on the 44th lap.
Sebastian Vettel lost the battle, not the Formula One title.
Earlier in the race Raikkonen and Verstappen retired after a coming together on the first lap, and it was Force India filling the gap with fourth and fifth for Perez and Ocon respectively. Alonso was only 12th while British driver Jolyon Palmer finished 16th and last of all the classified runners following another disappointing day at the office.
"Seb was really fast", Hamilton said after the race. "That is as close as it could be". The success of those improvements coupled with the Silver Arrows' clever decision-making has left Hamilton optimistic for the gruelling battle ahead.
"It was just the rawest fight I can remember having for some time, which I loved.
I don't know how we managed to lose that", said Vettel.
IEA sees oil market rebalance but warns of Libya, Nigeria surge
Immediately after the briefing, oil prices began an upward swing to a three week high, gaining almost $2 on the barrel. This fluctuation had resulted in the rise of 2.5 percent in the stock price of the crude oil in the commodity market.
"He drove a fantastic race but I can understand how he feels". Well done to him.