The three-time champion recovered after losing the lead from his 64th pole position to make the most of key strategic decisions and win with power and precision ahead of championship leader Sebastian Vettel of Ferrari and Australia's Daniel Ricciardo, who was third.
Hamilton finished the 66-lap contest 3.5 seconds ahead of the four-time champion German, having blasted past him to regain the lead after 44 laps.
It was his second win in five races this year and the 55th of his career and it brought him within six points of Vettel in the title race. The German now has 104 points and Hamilton has 98.
"That is how racing should be," said a delighted Hamilton. "Seb was really fast! My start was not good enough -- I got a bit of wheel-spin and I will have to talk to my guys about that, but the team did a great job this weekend."
"At turn one, when we made contact, I just felt like I ran out of road and I was on the outside...but that is racing, and I wouldn't have changed it for the world."
After being edged into second place during a contest that delighted the crowd in Catalonia, Vettel said: "I was pushing. I had a really good start. Lewis and myself picked up wheel-spin straight away. I pulled the clutch in and could gain on him.
"I stayed ahead and then got into a nice rhythm. But Lewis was fast, too. I tried to brake as late as possible into turn one, locked up, but managed to stay ahead. Then, when I was alone, he just flew past me down the straight.
"It was a shame, but it was a nice race."
On a near-perfect Spring day by the Mediterranean, Vettel made a masterful start to take the lead on the long drag into Turn One where Kimi Raikkonen collided with Max Verstappen and Fernando Alonso made contact with Felipe Massa -- the former two retiring on the first lap.
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.
Bottas, who claimed his maiden F1 victory in Russia last month, retired when his engine failed while he was running third.
Hamilton's tactical choice allowed him to switch to the softs on lap 36 with Vettel putting on mediums a lap later.
Hamilton then produced a great move to pass Vettel at the start of lap 44, powering past him on the outside of the straight, leaving his rival feeling helpless to resist.
"No chance, no chance –- like a train!" exclaimed Vettel.
"That was a very tough race. Physically it was hard. My neck is fine, but I lost nearly two kilos out there today and I was really straining to keep up with Seb," Hamilton added.
"It is a real privilege to race against someone as good as him."
Ricciardo, in a Red Bull, was more than a minute adrift of the leaders, ahead of Mexican Sergio Perez and his Force India team-mate Frenchman Esteban Ocon.
German Nico Hulkenberg came home sixth for Renault, ahead of compatriot Pascal Wehrlein of Sauber, who lost his place due to a time penalty for a pit-lane mistake during the race.
Spaniard Carlos Sainz was eighth on the road, but classified seventh, ahead of Russian Daniil Kvyat who did a superb job for Toro Rosso after starting at the back of the grid, and Frenchman Romain Grosjean of Haas.
Every driver, apart from those on the podium, was lapped during an exhausting contest that saw Finn Kimi Raikkonen of Ferrari and last year's winner, Dutch teenager Max Verstappen, crash into retirement on the first lap.