Sebastian Vettel had stated that he was not too concerned about losing out on a win at the previous round in Baku and dropping 13 points by finishing fourth after his overcommitted passing attempt on Valtteri Bottas.
Both Ferrari men delivered sloppy first runs en route to pole position, but because of that, they should have been back on track, on the Super Softs, when their final runs commenced.
After his unlikely victory in Azerbaijan it was a second straight win for Hamilton as he bids for a fifth world championship - and it couldn't have been extra comfy.
"This is more like it, let's keep this up", Hamilton told his celebrating team over the radio as he swept past the chequered flag.
The victory will be hugely pleasing and of some relief to the British driver and his team.
After dominating in the season opener at Melbourne but failing to win after Vettel took advantage of a late virtual safety vehicle, Mercedes admitted a software error had caused the miscalculation that had cost Hamilton.
It was the first one-two of the season for Mercedes, which had been slower than Ferrari in the past few races. And so you give it everything on an out-lap and you still don't have your tyres in the (performance) window. The thinner tread on the rubber Pirelli have supplied this weekend in response to the blistering during testing in Barcelona certainly seemed to work to their advantage and the same type of tyres will be used at the French and British grands prix. Victory here will have given the defending champion the impetus he has felt has been lacking for the past three races.
It was the second dubious pit call by Ferrari, who called Vettel early for his first pit stop on lap 17 in an attempt to pre-empt an attack from Bottas.
His Haas spun back across the track in a cloud of black smoke ahead of the oncoming cars -? leaving Pierre Gasly and Nico Hulkenberg with nowhere to go as they plunged into the spinning Haas machine.
Nico Hulkenberg and Pierre Gasly were caught up in the chaos and could do nothing to avoid the Frenchman's careening auto.
But Mercedes' decision did prove to be the right one and both drivers managed it with aplomb though Hamilton had been particularly serene out front. Hamilton led Vettel by 12 seconds and stayed out as the German pitted, comparatively slowly, for fresh medium tyres and rejoined fourth.
Although Red Bull briefly threatened after Verstappen delayed his one and only stop, Hamilton ultimately finished almost 30 seconds clear of the Dutchman.
Max may have been lucky to finish inside the top three after his Red Bull made contact with Lance Stroll's Williams on Lap 40, removing a large chunk of his front wing. Red Bull hoped the new parts it brought to Spain would close the qualifying gap but its drivers were four tenths behind the lead pair. Earlier than planned pit stops for Vettel meant that ultimately he had to concede not only second place to Bottas but also third to Verstappen. When asked why Raikkonen was one-stopping and he was two-stopping, Vettel said it was down to the timing of the first pit stop.
After a hard start to the season Verstappen could not even buy a trouble-free race and he lost some front wing after clipping the Williams of Lance Stroll on the restart after the VSC, although he was able to continue without stopping again. Hamilton had already built a commanding 10-second lead and stayed out longer, with is only pitstop coming on lap 26.
It was a fairly straightforward win for Mercedes and Lewis Hamilton.