Jurgen Klopp's side fell to a 1-0 defeat to Los Blancos in the showpiece event last term and will now have their chance for revenge against Carlo Ancelotti's side this time around.
The Reds progressed from Group A in second place behind Napoli to meet Real Madrid, who edged out RB Leipzig to finish top of Group F on the final matchday.
As group runners-up, Liverpool will have home advantage in the first leg against Real Madrid, with those last 16 ties being played on February 14 and 21 before the second legs on March 7 and 14.