Max Verstappen started on pole in Bahrain, but despite the Red Bull having had the edge over Hamilton's Mercedes in practice and qualifying, it was the seven-time world champion who triumphed.
It did not come easy for Hamilton, who had to see out a late attack from Verstappen to secure his first season-opening success in six years.
The victory only came courtesy of an error from the Red Bull driver, who was adjudged to have gone beyond track limits during a potentially decisive overtake with four laps left to go, and was instructed to immediately give the place back.
If Sunday's evidence is anything to go by, Verstappen and Red Bull are well placed to make more of a challenge this season.
Speaking in his post-race interview, an exhilarated Hamilton said: "Wow! What a difficult race that was.
"Stopping early we knew would be difficult but we had to cover Max, they have had an amazing performance all weekend.
"We suffered the last stint. Max was all over me at the end and I was just about able to hold him off. That was one of the hardest races I've had for a while."
Asked if he was at the peak of his powers, 36-year-old Hamilton replied: "I definitely am. Each year they are talking about when you hit your peak and timing is everything.
"I think I am at that and Max is doing really well at the moment. I love the challenge."
Verstappen, meanwhile, looked to take the positives after crossing the line just 0.745 seconds after Hamilton.
"It's a shame but you also have to see the positive. We are really taking the fight to them, and I think that's great to start the year like that," Verstappen said.
"I don't know what happened with the car early on. It don't think it was completely solved in the low-speed corners, so we'll have a look at that. Overall, we managed to finish the race and score good points."
It was a sentiment echoed by Red Bull chief Christian Horner, with the team's principal believing they are finally ready to mount a serious title push this year.
"A great race, a tough one to lose. It is the first of 23 so hopefully, we give Lewis a harder time this year," Horner told Sky Sports.
"Once you have that instruction [to give the place back] you have to move out of the way. It is tough racing, it is fair racing.
"The races come thick and fast once we get going. Mercedes have been so strong over the years. I think the biggest winner today was the fans. It sets up a great season and I hope we see more battles between Max and Lewis this season."