With nearly the final kick of the game, the five-time Ballon d'Or winner blasted past Geronimo Rulli at the back post to relieve the increasing pressure on United manager Ole Gunnar Solskjaer.
United were on the verge of yet another humiliating Champions League group stage exit after falling behind to Paco Alcacer's clever finish early in the second half.
Alex Telles' astonishing strike promptly equalized, but until Ronaldo's late intervention, a sixth draw from open play in as many meetings between the teams looked likely.
Regardless of the outcome, the performance did little to assuage mounting doubts about Solskjaer's ability to get the best out of a group of tremendously talented individuals who have yet to gel as a unit.
On Saturday, United were defeated 1-0 by Aston Villa thanks to a stoppage-time penalty that ended up in the Stretford End, but Solskjaer showed his support for the Portuguese midfielder by awarding him the captain's armband in the absence of Harry Maguire.
Juan Foyth easily kept the England winger in check before Edinson Cavani came in 15 minutes from time.
With the goal gaping from Greenwood's exquisite cross, the Uruguayan had a fantastic chance to make himself the hero right away, but he somehow headed wide.
De Gea came to United's rescue once more five minutes from time, save Moi Gomez and Boulaye Dia in a goalmouth scramble.
And Villarreal's profligacy in front of goal came back to bite them as the all-time leading goalscorer in Champions League history demonstrated how to finish.
Deep into stoppage time, Jesse Lingard turned a loose ball Ronaldo's way, and his effort was too powerful for Rulli.