DR Congo striker Cedric Bakambu helped Villarreal to move back to within eight points of the Spanish La Liga top four with a controversial stoppage-time winner to deny Leganes.
Leganes goalkeeper Iago Herrerin complained that Bakambu handled the ball for the winner in the 92nd minute.
"It was a handball that everyone saw," Herrerin told beIN Sports. "It was impossible not to see it."
Leganes sit just above the relegation zone, while Villarreal stay fifth.
Bakambu had put Villarreal ahead on 68 minutes, before Miguel Angel Guerrero looked to have salvaged a vital point for Leganes, equalising in the 90th minute.
However, Bakambu struck again just two minutes later and the winner was allowed to stand, despite the Congolese striker having appeared to handle the ball to turn home Jonathan dos Santos's cross.
The dramatic late win for the Yellow Submarine kept them in the hunt for European places.
Bakambu later simply tweeted: "Job's done."