Real dominated the final with Sergio Ramos and Gareth Bale scoring.
In the 37th minute Ramos opened the scoring when he rose above the San Lorenzo defence to send a header past goalkeeper Sebastian Torrico from a Toni Kroos corner.
Bale made it 2-0 six minutes into the second half when he collected a pass from Isco and fired a tame shot straight at Torrico. But the Argentine 'keeper fumbled the ball over the line. Real 'keeper Iker Casillas was relatively untroubled throughout the match.
New Zealand's Auckland City came third after defeating Cruz Azul 4-2 in a penalty shoot-out to become the first Oceania team to win a medal at the tournament.
The sides were locked 1-1 at the end of normal time with defender Ryan de Vries' goal in first-half injury time equalised by Joao Rojas' close-range effort just before the hour mark for the Mexican side.
In the shoot-out, Sanni Issa scored the eventual winner for the semi-professionals from Auckland.