The Wales forward however ended the night in despair as he was sent off in added time for receiving two yellow cards.
Real were severely weakened by six injuries to attacking players and fell behind in the 11th minute.
This was after captain Sergio Ramos lost the ball in his own half and Villarreal broke quickly, with Gerard Moreno scoring on the rebound.
Bale equalised in stoppage time of the first half by tapping in a cross from Dani Carvajal from close range.
But Villarreal restored their lead in the 74th minute through Moi Gomez, after Karim Benzema had a goal ruled out for offside.
Bale has a long and successful record playing at Villarreal.
He scored there on his Real debut in 2013 after completing his 100 million-euro move from Tottenham Hotspur and netted in a 3-2 win in 2017 and a 2-2 draw in 2018.
He again pulled Madrid out of trouble with a powerful low strike in the 88th minute but somehow contrived to get himself sent off by earning two yellow cards for fouls in stoppage time.
Real have picked up five points from their opening three games, one more than champions Barcelona, but Zinedine Zidane’s side are four points behind leaders Atletico Madrid, who have won all three matches.
Zidane criticised his side for their lacklustre start but was pleased with how they reacted to going behind.
“We began the game without any intensity, we were barely in the game for the first 15 minutes, it’s always important to make a strong start,” he told a news conference.
“But we reacted well and we deserved to score more goals.
“We were up against a good opponent and we have to improve in defence because we know what we are capable of in attack.
“But I’m focusing on the positive things we did today, above all our reaction, because it was very important that we didn’t lose today.”