The Mercedes driver finished just 0.6 seconds ahead of team-mate Nico Rosberg at Barcelona.
"Nico did a fantastic job today, he was very quick," said Hamilton.
"I struggled to keep him behind and was grateful I was able to.
"I think I have a bit of work to do over the next few weeks, we struggled last year in Monaco and struggled at this race.
"I have to find out where I am losing the time and apply it the next race.
"By no means is it easy for me, I still have a massive challenge from Nico.
"But I could never imagine these four race wins... It is still so close, there is a long, long way to go and I have a bit more time to find in this car."
Despite admitting that Rosberg had been unnervingly close to him, Hamilton said he was enjoying he battle a lot - and was thrilled to have won the Spanish Grand Prix for the first time in his career.
"It's a huge boost for me and the team, and it's because of all the hard work we have done," said Hamilton.
"I am enjoying every step of the way."
- Sports & Recreation
- Nico Rosberg