Barca's captain has only just recovered from a niggling calf problem, which he sustained at the start of August, and his latest issue appeared to be with his left thigh, AFP reported.
Messi took treatment after half an hour at Camp Nou and while he continued until the interval, he was replaced by Ousmane Dembele for the start of the second half.
Barcelona will hope the problem is not serious. After injuring his calf on August 5, Messi made his first appearance of the season against Borussia Dortmund last week, when he came on as a substitute.
He was also introduced off the bench in Barca's defeat by Granada on Saturday but was deemed fit enough to start against Villarreal.
Ernesto Valverde's side plays at Getafe on Saturday before hosting Inter Milan in their second Champions League group game next Wednesday.
Further ahead, it faces Real Madrid in the first Clasico of the season on October 27.