The game between the two Argentine sides was controversially moved to the Spanish capital after being twice-postponed a fortnight ago in Buenos Aires when River Plate fans attacked Boca's team bus and injured two players.
Boca took the lead just before half-time through Dario Benedetto, but River won the trophy for a fourth time by mounting an impressive comeback.
Lucas Pratto sent the game into extra-time and Wilmar Barrios was sent off for Boca, allowing River substitute Juan Quintero to score from the edge of the area and Piti Martinez to grab a late third while Boca goalkeeper Esteban Andrada was in the opposition's half.
"We are fair winners of the trophy and now we have to celebrate," River hero Quintero said.
"I didn't think, I [just] got the ball… looked for space, controlled it and shot. Yesterday I worked on that shot and I scored a goal I have to celebrate.
"We knew Boca is a very tactical and physical team, but we worked until the end and that's where the difference lay."
The first leg at Boca's Bombonera stadium finished 2-2 on November 11, and with no away goals rule in the final everything was left to play for Sunday at the Santiago Bernabeu.
After the trouble that stopped the second leg being played at River's Monumental, a heavy Spanish police presence ensured there was no violence before the game in the Spanish capital.
Benedetto sent Boca ahead at the end of a brilliant counter-attack, reaching Nahitan Nandez's sublime through-ball to finish well.
River should have had a penalty when goalkeeper Andrada fouled Pratto in the second half, but the forward scored anyway a few minutes later after good work from Nacho Fernandez.
Two minutes into extra-time Barrios was dismissed for his second yellow card after an ugly challenge on Exequiel Palacios, which handed River a huge advantage.
Substitute Quintero took advantage with a brilliant goal from distance after 109 minutes to send River ahead and force Boca into desperation mode.
Goalkeeper Andrada was in River's half for a corner in stoppage time when Martinez broke downfield to run the ball into an empty net with the final kick of the game to spark wild celebrations.
"We were the only team who played in the opponent's half, now it's time to celebrate with the fans and our team-mates," Martinez said.
Boca coach Guillermo Barros Schelotto said he was hurt by the defeat.
"We feel a great sadness. Not just for the fans who accompanied us here but all of those who supported us," he said.
"After Barrios was sent off River started to use the ball better. In extra-time the extra man helped them control the game.
"I feel an enormous pain for myself, but more for the people."