Viktoria Plzen's 2-1 victory over CSKA Moscow in the group's earlier match meant that both Roma and Madrid had qualified for the first knockout round before kickoff in Rome.
Roma had two more opportunities 10 minutes before the break, but Patrick Schick saw his close-range attempt kept out by Thibaut Courtois, before Aleksandar Kolarov flashed a powerful effort just wide of the post.
Real Madrid had a couple of half-chances of their own late in the first period, but Olsen kept out a strike from Toni Kroos, before Modric missed the crossbar from distance.
Easily the best chance of the first period fell to Under in the second minute of added time, and it might well go down as one of the misses of the season.
Indeed, the in-demand attacker found himself presented with a Nicolo Zaniolo cross in front of an open Madrid goal, but he somehow fired over the crossbar.
Instead, it was Real that took the lead less than two minutes into the second half. A poor kick from Olsen ultimately led to Bale finding all sorts of space inside the Roma box, and the Welshman slid the ball into the bottom corner for his sixth goal of the season.
Bale had another opportunity in the 50th minute when he broke into a one-on-one situation with Olsen, but Roma's goalkeeper made a smart save to keep the score at 1-0.
Real Madrid did have their second just before the hour, however, when Vazquez tapped a clever Karim Benzema header into the back of the net from close range.
It should have been 3-0 in the 61st minute when Marcelo found time and space inside the Roma box, but the Brazilian could not find a strike past Olsen, who then saved from Benzema five minutes later.
Courtois kept out a powerful Kolarov strike 10 minutes from time as Roma looked to hit back. It was not to be for the home side, but they will be present in the first knockout round of the competition.
As for Madrid, it was the perfect response to their 3-0 defeat to Eibar at the weekend, and the result reminded a few that they will not be giving up their European crown without a fight.
ROMA: (4-2-3-1) Olsen; Florenzi, Manolas, Fazio, Kolarov; N'Zonzi (Coric 64'), Cristante; Cengiz, Zaniolo (Karsdorp 69'), El Shaaraway (Kluivert 22'); Schick
REAL MADRID: (4-3-3) Courtois; Carvajal, Ramos, Varane, Marcelo; Kroos, Modric (Valverde 81'), Llorente; Lucas, Benzema (Mariano 77'), Bale (Asensio 84')