Real scored in each half to clock up a 22nd straight win in all competitions in a bruising encounter which Guatemalan referee Walter Lopez just managed to keep under control.
The Marrakech crowd gave the European champions fervent support and were expecting a gala exhibition, which San Lorenzo were not going to allow despite the obvious gulf in class.
"It's a special day and this is a reward for all the effort and work that we have put in as a team," said Ramos.
San Lorenzo coach Edgardo Bauza added: "I told the players in the dressing room that I was proud to have led this team this year. Each defeat hurts, even when it is against a team as successful as Real Madrid, and we have to accept it."
Real nearly scored on their first attack when Karim Benzema just failed to connect with Ronaldo's low cross from the right.
After that, San Lorenzo did well to restrict Real to a couple of chances in the opening half hour only for their resistance to be broken at a corner when Ramos outjumped the defence in the 37th minute to break the deadlock.
Ramos had already been booked and could have been sent off for an ugly face-to-face rant at the referee as the game, which featured 40 fouls and numerous confrontations between players, threatened to get out of control.
Bale increased Real’s lead in the 51st minute when he was left unmarked to collect Isco's pass and diving keeper Sebastian Torrico allowed the Welshman's weak shot to slip under his arm.
Real stopper Iker Casillas had to wait until the 65th minute to be tested for the first time when he saved a low diagonal effort from Emanuel Mas.
He then made more difficult stops to deny Juan Mercier and Enzo Kalinski, although Real also missed several chances to score a third on the break.
Real had previously won the old Intercontinental Cup three times, with their last triumph coming in 2002.