Hamilton clocked in with a time of one hour, 35 minutes and 29.972 seconds at the Circuit de Barcelona-Catalunya, over 20 seconds ahead of fellow Mercedes driver Valtteri Bottas of Finland, reports Efe.
Ricciardo was fifth while Hamilton won. He wasn't fast enough to keep pace with Hamilton up front but looked quick enough to at least secure second place.
"I think, as a team, this weekend we have been flawless, and we just need to continue like that and for me also the wins are going to come", Bottas said. "A 1-2 for the team", Hamilton said.
"I'm really happy. I said I wanted to come and win in the way that I have won".
"People probably think it was an easy race and I was cruising but I wasn't cruising", he explained.
"That happiness and that uplift from inside that I have that feeling".
Mercedes has struggled compared to Ferrari at times this season, with Sebastian Vettel winning the opening two races and taking three consecutive pole positions as the Scuderia had a more consistent auto.
However, Vettel - now trailing race victor Lewis Hamilton by 17 points in the drivers' standings - says rapid tire wear had become an issue for the team and that they had no choice but to bring him in for that costly second stop.
The safety vehicle has helped add to the drama of the early part of the 2018 season and its appearance early in Sunday's race means it has been used in the opening five races of a championship for the first time.
"Our tires didn't last as long as for the others, so we couldn't follow the same strategy", Vettel said. I think it was the right thing to do. "Even in the end, with the fresher set I wasn't able to attack until the end", he added. On the soft tyres, Vettel could manage 4 laps fewer (20 in total) than Alonso who managed 24 laps on his super soft. But the move backfired as Sergio Perez delayed Vettel's safe release and saw him re-emerge behind Red Bull's Max Verstappen, who beat the 30-year-old to the final place on the podium.
Most improved: Mercedes may have broken Ferrari's run of consecutive pole positions, but Alonso qualifying eighth is arguably the most obvious change from previous rounds. After Raikkonen's auto suffered from power unit issues in the Free Practice 2 session, the Iceman retired from the race from what seemed to be a similar issue. This was the second time in the last five races that only one Ferrari auto reached the finish line.
Verstappen went from zero to hero, taking his first podium of the season after a frustrating weekend in Baku, while a spin under the virtual safety vehicle meant Daniel Ricciardo couldn't take advantage of Vettel's second stop. "It's a good feeling".
The safety vehicle was deployed for six laps here to deal with the debris before Hamilton executed a masterful restart to leave Vettel for dust, and by lap 15, the Brit had already moved 6.5 seconds clear of his rival.
Sainz's points lifted Renault ahead of McLaren and into fourth place by a single point.