Hamilton owed his recovery to key decisions including switching to a set of medium tyres at his first stop, when Vettel remained on softs, and a selfless contribution from his team-mate Valtteri Bottas, to win with power and precision.
Other than the battle at the front, the other major talking point was the first corner tangle between last year's Spanish Grand Prix victor Max Verstappen in the Red Bull and Vettel's teammate Kimi Raikkonen.
Daniel Ricciardo picked up his first podium of the season as he took third for Red Bull, ahead of the two Force Indias of Sergio Perez and Esteban Ocon.
"It all started when I got hit, my vehicle jumped a bit and you can not control after that", Raikkonen said.
"He still somehow managed to get a decent exit [from the chicane] so I couldn't do it first time", said Vettel.
MONTMELO, Spain (AP) - Lewis Hamilton beat Sebastian Vettel to win the Spanish Grand Prix on Sunday, tightening Formula One's intense title fight.
It is also Hamilton's 55th career victory.
He said: "It was the rawest fight I can remember having for some time, which I loved".
Foreign fighters among militants in Philippines
He said all of the 11 Indonesian citizens were now outside of the conflict area in Marawi and under the protection of the police. The Philippines is Asia's largest Roman Catholic nation, but its southern region has a large Muslim minority.
"This is what the sport needs to be every single race.to have that close battle with him, a four times champion, is awesome", added the triple champion. I pulled the clutch in and could gain on him. This is why I race. "We lost four seconds".
Hamilton said: "I gave you space, otherwise we would have touched..."
"We were told that the engine could do one more race, but it seems like it could not take it anymore".
After getting away well, Hamilton was left behind by Vettel in the second phase of the start.
Vettel had to struggle being behind the other Mercedes auto of Valtteri Bottas.
"I think our tyre choice was the right one, obviously Lewis sits behind, he has nothing to lose, there's no threat from behind so he might as well try to mirror the strategy from the first stop onwards". Bottas was later forced to stop his Mercedes when it started spouting smoke midway through the race. Ferrari is close behind with 153 points and Red Bull is a distant third with 72 points.
Hamilton's victory was just his second of the 2017 season and sees him move to within six points of Vettel in the Driver's Championship.
"I was a bit surprised when he came out and it was already so close", said Vettel, whose championship lead has been cut to six points.