With Atletico poised to win the trophy for the first time after going ahead with a first-half Diego Godin header, Real struck back after relentless pressure with a Sergio Ramos header in the third minute of added time from a Luka Modric corner.
That sent the final into extra time and with a tiring Atletico almost out for the count after taking a battering for most of the second half, Real scored three times in the last 10 minutes.
World record signing Bale headed them in front after 110 minutes, Marcelo made it 3-1 following a solo run eight minutes later before Ronaldo, the Portugal captain playing in his capital city, converted a penalty with almost the last kick.
The goal was Ronaldo's 17th of the Champions League campaign, a record for one season, and he became the first player in the competition's 59-year history to score for two different winning sides in open play in the final, having scored for Manchester United when they won the 2008 European Cup.
The victory also meant Carlo Ancelotti became only the second coach to win the European Cup three times after Bob Paisley's Liverpool triumphs in 1977, 1978 and 1981.
Italian Ancelotti also won the trophy twice as a player with AC Milan in 1989 and 1990, while Real became the first team to score four goals in the final since Milan's 4-0 win over Barcelona in 1994.
"Yes that was just incredible, what can I say, it was our aim from the start of the season," Ancelotti told reporters. "It was such a hard game and Atletico were such powerful opponents, but I think we deserved it in the end.
"We scored in extra time. We believed that we could win the game and it went well for us in the end. Everyone did well and what they could and we finished drained, exhausted but very, very happy. Were we lucky to score so late I don't think so, I think we deserved it."
In contrast Atletico coach Diego Simeone was ordered off the field by referee Bjorn Kuipers for running on to the pitch after Atletico went 4-1 down, but he was much calmer when he faced the media later, walking in to applause at the news conference.
The Argentine said he was angry because Real defender Raphael Varane flicked the ball at him but added that he should not have acted as he did. "At that point it was pointless for the player to create that situation," he said.
"After a 4-1 scoreline maybe it was pointless for me to get angry. But if you analyse the whole match Real Madrid were better in the second half, they pinned us in our own half and we could not move."
For Atletico the evening evoked painful memories of the last time they reached the final in 1974 when they were leading Bayern Munich in Brussels only for Georg Schwarzenbeck to equalise in the last minute of extra time to force a 1-1 draw and a replay which Bayern won 4-0 two days later.
This time Atletico were almost as close to glory and a Champions League and domestic league double but instead Real secured a Champions League and Spanish Cup double as Ancelotti's first season in charge ended in absolute joy for their fans at the Stadium of Light and utter dejection for Atletico's.
A header from Bale 20 minutes into extra time turned the match a month after the Welshman scored the winner with a stunning solo goal in a 2-1 King's Cup triumph over Barcelona.
His latest goal repaid a further chunk of the 100 million euros ($136.31 million) Real paid Tottenham Hotspur to secure his signature last August and all but killed off any hope the flagging Atletico players had of winning the match.
Marcelo made it 3-1 with a shot from outside the box that goalkeeper Thibaut Courtois probably should have saved before Ronaldo converted the penalty after being fouled by Gabi.
Atletico had suffered a setback in the ninth minute when their leading scorer Diego Costa succumbed to the hamstring strain he picked up playing against Barcelona last week.
Although they took the lead after his departure, and held it almost to the end of normal time, the Brazil-born Spanish international's presence could have given them a greater advantage.
Instead, with the game still finely balanced, Bale went close to scoring on three occasions in normal time while Ronaldo also had his chances, including three in a 90-second spell as Real hammered away for the equaliser.
Eventually Atletico caved in when Ramos equalised and Bale then turned the match Real's way as he rose at the far post to head home, after a shot from Angel Di Maria was deflected into the air off the keeper.
The Argentina winger was named Man of the Match for his tireless running and passing.
The end of the game was marred by an unseemly brawl sparked by Simeone but, after everyone had calmed down, Real skipper Iker Casillas led his team mates to collect the trophy he won as a young keeper in 2000 and again in 2002.
Casillas was a relieved man at the end because it was his mistake that led to Atletico taking the lead after 36 minutes. Stranded in no man's land, Godin got to a loose ball before the Real keeper did to head it goalwards.
Casillas rushed back to try to scoop the ball away but it had already crossed the line.
That looked likely to cost his side dearly but, inspired by the speedy runs of Di Maria, clever passing and moving from Modric in midfield and a hard-working performance from Ronaldo, Real gradually swung the match their way.
Following their triumphs of 1998, 2000 and 2002, Real became the first team to lift the trophy four times since the Champions League was reformatted in 1992. It was a hard-won victory for Real but in the end they deserved it.