Messi, who had recovered from a calf injury to feature, was replaced at the start of the second half after suffering a thigh problem.
The Argentine, making his 400th La Liga start, provided the corner for Antoine Griezmann to head home off the bar before Arthur made it 2-0.
Santi Cazorla pulled a goal back.
After the game, Barca boss Ernesto Valverde described Messi’s injury as a “small problem in the adductor”.
“When something happens to Messi, everyone stops, not only on the field, but in the stands as well,” he said.
“As a precaution we have decided not to risk it. In theory, it is nothing more but we will see tomorrow how it is.”
Although far from their fluent best, Barcelona climbed four places up the table to fourth in La Liga to help ease the pressure on Valverde after a poor start to the season.
After his injury, the Barca captain received treatment on the edge of the pitch before carrying on until half-time.
The forward was replaced by French striker Ousmane Dembele at the start of the second half.
Elsewhere, newly promotedGranadawent top of La Liga – level on points with Athletic Bilbao and Real Madrid – after drawing 1-1 atReal Valladolid.
Real Madridentertain Osasuna on Wednesday (20:00 BST) whileBilbaoare at bottom club Leganes (18:00 BST).