Pablo Maffeo, on loan from Manchester City, stifled Messi in an impressive man-marking effort, stopping the 30-year-old from adding to his nine league goals of the campaign.
However, the Blaugrana still emerged triumphant, with Luis Suarez's strike and own goals from Francisco Aday and Gorka Iraizoz giving the visitors their sixth consecutive league win of the new season.
"The man-marking was clear and we had to find the place where to put Messi to move that player (Maffeo) and to get the most out of the situation," Valverde told reporters after the game.
"You have to take advantage of the situation. We tried to get the better of them by playing in the space and taking advantage of Leo's movement.
"I think Messi was fine. It's true that when you're man-marked it can be uncomfortable, but it also has advantages, not for him, but for the team. I think he was relaxed about it all.
"It was a difficult game because it was a derby, because of the atmosphere and the tension, but I think we managed it well. Maybe we struggled to finish the game off, but we've got the win."
Up next for Barca is a Champions League trip to the Estadio Jose Alvalade on Wednesday night to face Portuguese giants Sporting Lisbon.