Ferrari teammate Kimi Raikkonen was third with Australian Daniel Ricciardo fourth in the Red Bull.
Vettel, who started on the second row, challenged at the start but sat in third place through the opening stint of the race as Hamilton had control in the Mercedes. He was the last of the leading cars to make his pit stop but got a free kick when a virtual safety car intervened. The German pitted and got the advantage of the shorter route via pit lane and the fact that Hamilton was stuck going at the speed limit on track. It meant the Ferrari got out in front.
Hamilton yielded road position and had older tyres than his rival at that point and a small lock up once they race went green again ended any chance of him getting back in front.
"We got a bit lucky obviously with the safety car," Vettel admitted. "I really enjoyed it. I was hoping for my start to be a bit better but it didn't really work so I had to settle for third. I lost a bit of connection to Lewis and Kimi ahead.
"I was praying for a safety car and then when I saw it I was full of adrenaline.
"When we got out ahead I knew it was difficult to pass but he kept some pressure on but in the last five laps I could enjoy it a little more."
It was a bittersweet day for the Haas Racing team. Kevin Magnussen and Romain Grosjean were running in fourth and fifth and right in the mix but then both cars slowed immediately after making their first pit stops. It appeared there was some failure getting tyres put on correctly and both were forced out of the race. The signs were extremely encouraging however.
It was a good day for McLaren as they completed their first race with Renault power. Two-time world champion Fernando Alonso finished an impressive fifth while Stoffel Vandoorne brought the second car home in ninth.
The next race is in a fortnight in Bahrain.