Substitute Mauro Matos scored a stoppage-time winner as San Lorenzo sealed their place in the final of the Club World Cup following a 2-1 victory over Auckland City.
Matos, who was introduced with 13 minutes remaining, struck in the third minute of added-on time at the Stade de Marrakech to set up a showdown with European champions Real Madrid.
San Lorenzo, this year's Copa Libertadores winners, took the lead just before half-time through Pablo Barrientos but Angel Berlanga levelled matters midway through the second half.
The game looked to be heading for extra time, but Matos' last-gasp strike settled matters in the Argentinian side's favour.
Auckland City, winners of the OFC Champions League, will take on Mexican side Cruz Azul in the third place play-off.