The Astros were trailing 3-2 entering the ninth but struck for four runs against closer Danny Farquhar (0-3) to grab control of the contest.
Marc Krauss drew a one-out walk and pinch-runner Jake Elmore went to second when Carlos Corporan also coaxed a free pass and was replaced at first by Marwin Gonzalez.
Jimmy Paredes then sent a single to right, scoring Elmore with the equalizer.
That brought up Villar, who grounded a hit up the middle, chasing home Gonzalez and Paredes with the decisive runs.
Villar later came around to score on Justin Smoak's throwing error, capping the big inning that carried the Astros to a victory in the first of a three-game series.
Kevin Chapman (1-1) notched his first major-league win for Houston.
Abraham Almonte and Brad Miller homered for the Mariners.