After Real Madrid dropped points against Real Betis, Barca knew they could move level with their Clasico rivals in second place with a game in hand should they pick up all three points. A win would also put pressure on leaders Atletico Madrid who face Athletic Bilbao later on Sunday.
But Barca were behind after 26 minutes after they committed too many men forward and were caught out when Pau Torres' superb pass was latched onto by Samuel Chukwueze. The Nigeria international rounded goalkeeper Marc-Andre ter Stegen before finishing off from a tight angle.
Unai Emery's side were ahead for just two minutes as Griezmann found the back of the net after being picked out by Oscar Mingueza.
The ex-Atletico forward got his second to complete the turnaround on 35 minutes as he latched on to an awful backpass by on-loan Tottenham Hotspur defender Juan Foyth and hit a first-time effort past goalkeeper Sergio Asenjo.
Despite being down to 10 men, Villarreal continued to press and Barca were hanging on at the end.
Asked whether Barca, who recently won the Copa del Rey, could end the season with two trophies, manager Ronald Koeman said: "I have never said [the Double] is impossible, but when you are so many points behind the leaders as we were, you have to go game by game.
"Atletico play tonight [Sunday], we will see. We have six games left. We're there. The team is hungry to win another big title. But game by game is going to be the best way to win the league."