Hamilton won from pole, unchallenged by the rest of the grid.
Valtteri Bottas posted the quickest time and finished less than 0.1s clear of Antonio Giovinazzi's Ferrari on the second day of in-season testing in Barcelona. The drivers and teams know the track too well, and the layout of the track with those long-radius medium- and high-speed corners means that it's hard to follow another vehicle.
Racing resumed a few laps later and, from that point on, Hamilton distanced himself from the pack.
The virtual safety auto came out on lap 40 after Force India's Esteban Ocon suffered mechanical failure.
Sebastian Vettel has called on Ferrari to address their problems after their slump in Barcelona.
Such was the pace of Hamilton in clean air ahead that by the 15th lap, he had already opened a 6.4-second gap on Vettel.
Vettel also backed his team on their decision to pit when the virtual safety vehicle was required, despite the decision for a second stop being highly criticised after the end of the race.
"For me it's not about setting records everywhere", he added. The Finn was going steady in fourth place before the first pit stop but he didn't even get to change his tyres as a technical issue forced him to retire his auto.
Raikkonen had been forced to take a second power unit earlier in the weekend, which will be a worry to Ferrari as all drivers are allotted only three power units for the entire season. On lap 21 Bottas makes the pass on Kevin Magnussen putting the Mercedes in sixth just 34 seconds behind Vettel. A slow pit stop dropped him into fourth place behind Max Verstappen.
In the 25th lap, Raikkonen's engine had had enough of the Spanish outing and gave way.
Lewis back on top... but for how much longer? This allowed the Red Bull cars to move ahead.
Hamilton kept closing in on the Red Bull in front of him and even got within DRS range, but knowing Verstappen, the championship leader was better off waiting for the inevitable to happen.
Daniel Ricciardo brought his Red Bull home in a lonely 5th place, behind Vettel.
The victory was Hamilton's third in Spain and it also extended his streak of points finishes to an unprecedented 30 races. It didn't take long for Max to change that, however, as he made a klutzy mistake while lapping - not overtaking, lapping - Lance Stroll and cracked his own front wing as he nudged the slower auto.
"The last three races have been fantastic, so why not just let that go until [the 2021 rules reset], then use those two or three years to get it done properly?" In 2016, there was the collision between Mercedes' Nico Rosberg and Lewis Hamilton and past year Kimi Raikkonen and Max Verstappen were out of the running after the first turns.